mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
Fix Issue 23863 - typeof rejects AliasSeq!() as argument (#15140)
This commit is contained in:
parent
9db1dfc17c
commit
d11ec36040
2 changed files with 19 additions and 2 deletions
|
@ -2804,8 +2804,10 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, out Expression pe, out Type
|
|||
}
|
||||
mt.exp = exp2;
|
||||
|
||||
if (mt.exp.op == EXP.type ||
|
||||
mt.exp.op == EXP.scope_)
|
||||
if ((mt.exp.op == EXP.type || mt.exp.op == EXP.scope_) &&
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23863
|
||||
// compile time sequences are valid types
|
||||
!mt.exp.type.isTypeTuple())
|
||||
{
|
||||
if (!(sc.flags & SCOPE.Cfile) && // in (extended) C typeof may be used on types as with sizeof
|
||||
mt.exp.checkType())
|
||||
|
|
15
compiler/test/compilable/test23863.d
Normal file
15
compiler/test/compilable/test23863.d
Normal file
|
@ -0,0 +1,15 @@
|
|||
// https://issues.dlang.org/show_bug.cgi?id=23863
|
||||
|
||||
alias AliasSeq(T...) = T;
|
||||
|
||||
struct S
|
||||
{
|
||||
}
|
||||
alias Empty = S.tupleof;
|
||||
Empty x; // accepts valid
|
||||
|
||||
static assert(is(typeof(x)));
|
||||
static assert(is(typeof(Empty)));
|
||||
static assert(is(typeof(AliasSeq!(int))));
|
||||
static assert(is(typeof(Empty) == AliasSeq!()));
|
||||
static assert(is(typeof(AliasSeq!()) == AliasSeq!()));
|
Loading…
Add table
Add a link
Reference in a new issue