[Issue 15945] New: sizeof on an invalid type seems to compile.
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Apr 21 07:15:25 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15945
Issue ID: 15945
Summary: sizeof on an invalid type seems to compile.
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: john.loughran.colvin at gmail.com
size_t foo(T)()
{
return T[0].sizeof;
}
void main()
{
auto a = foo!(ubyte[])();
assert(a == 1);
}
Seems like either that shouldn't compile, or (maybe?) the assert should pass.
Currently, it compiles and the assert fails.
--
More information about the Digitalmars-d-bugs
mailing list