Jump to page: 1 2
Thread overview
[Issue 20863] Passing aggregate types into templates by alias drops qualifier
[Issue 20863] Pass into template by alias drops qualifier
May 25, 2020
Adam D. Ruppe
May 26, 2020
Max Samukha
May 26, 2020
Max Samukha
May 30, 2020
Boris Carvajal
May 30, 2020
Boris Carvajal
Jun 04, 2020
Nick Treleaven
Jun 06, 2020
Boris Carvajal
Jun 24, 2020
Dlang Bot
Jul 08, 2020
Dlang Bot
Dec 17, 2022
Iain Buclaw
May 25, 2020
https://issues.dlang.org/show_bug.cgi?id=20863

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |moonlightsentinel@disroot.o
                   |                            |rg

--- Comment #1 from moonlightsentinel@disroot.org ---
Even smaller:

template staticFind(alias T, TList)
{
    enum bool staticFind = is(T == TList); // true;
}

static assert(staticFind!(Object, Object)); // pass
static assert(staticFind!(immutable Object, immutable Object)); // fail

--
May 25, 2020
https://issues.dlang.org/show_bug.cgi?id=20863

Adam D. Ruppe <destructionator@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |destructionator@gmail.com

--- Comment #2 from Adam D. Ruppe <destructionator@gmail.com> ---
I'm actually not sure if this is a bug or not.

But I didn't even know literal values were allowed to be passed to aliases, so I'm apparently behind the times!

But the spec isn't clear on if it takes built-in types at all, and is also underspecified on if it actually accepts a type or a symbol.

My thought is if it takes a symbol, the immutable qualifier might get legitimately dropped because that's part of the local type instead of the global symbol.

Of course it is more useful to just define it to take the whole type and be the same thing! But we should clarify the spec as well as the implementation to make it clear this is what is supposed to happen.

--
May 26, 2020
https://issues.dlang.org/show_bug.cgi?id=20863

Max Samukha <maxsamukha@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxsamukha@gmail.com

--- Comment #3 from Max Samukha <maxsamukha@gmail.com> ---
This is the same as or related to bug 2704.

--
May 26, 2020
https://issues.dlang.org/show_bug.cgi?id=20863

--- Comment #4 from Max Samukha <maxsamukha@gmail.com> ---
(In reply to Max Samukha from comment #3)
> This is the same as or related to bug 2704.

Link: https://issues.dlang.org/show_bug.cgi?id=2704

--
May 26, 2020
https://issues.dlang.org/show_bug.cgi?id=20863

uplink.coder@googlemail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uplink.coder@googlemail.com
            Summary|Pass into template by alias |Passing aggregate types
                   |drops qualifier             |into templates by alias
                   |                            |drops qualifier

--- Comment #5 from uplink.coder@googlemail.com ---
The issue is not quite correct

struct Foo {}

template P(alias X)
{
    pragma(msg, X);
    enum P = 1;
}

int y = P!(const int);
int x = P!(immutable(double));
int z = P!(immutable(Foo));
int z2 = P!(immutable Foo);

The output of this is
const(int)
immutable(double)
Foo

What happens is that the types which are not symbols are merely "losslessly
cast" to a symbol.
Therefore the STC is not dropped

--
May 26, 2020
https://issues.dlang.org/show_bug.cgi?id=20863

--- Comment #6 from uplink.coder@googlemail.com ---
struct Foo {}

template P(alias X)
{
    pragma(msg, X);
    enum P = 1;
}

int y = P!(const int);
int x = P!(immutable(double));
int z = P!(immutable(Foo));
int z2 = P!(immutable Foo);

The output of this is
const(int)
immutable(double)
Foo

What happens is that the types which are not symbols are merely "losslessly
cast" to a symbol.
Therefore the STC is not dropped.

That means the new addition of types matching to alias behaves inconsistently. Not the other way around.

--
May 30, 2020
https://issues.dlang.org/show_bug.cgi?id=20863

Boris Carvajal <boris2.9@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |13343


Referenced Issues:

https://issues.dlang.org/show_bug.cgi?id=13343
[Issue 13343] Strange behaviour aliasing struct members
--
May 30, 2020
https://issues.dlang.org/show_bug.cgi?id=20863

Boris Carvajal <boris2.9@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |boris2.9@gmail.com

--- Comment #7 from Boris Carvajal <boris2.9@gmail.com> ---
The issue 13343 is also related.

--
June 04, 2020
https://issues.dlang.org/show_bug.cgi?id=20863

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #8 from Nick Treleaven <nick@geany.org> ---
This bug is blocking the removal of template overloads in std.meta: https://github.com/dlang/phobos/pull/7513

--
June 06, 2020
https://issues.dlang.org/show_bug.cgi?id=20863

Boris Carvajal <boris2.9@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.loughran.colvin@gmail.
                   |                            |com

--- Comment #9 from Boris Carvajal <boris2.9@gmail.com> ---
*** Issue 20899 has been marked as a duplicate of this issue. ***

--
« First   ‹ Prev
1 2