[Issue 16481] invalid code accepted leading to linker error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 14 13:58:31 UTC 2020


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

--- Comment #3 from John Colvin <john.loughran.colvin at gmail.com> ---
(In reply to ag0aep6g from comment #2)
> Reduced further:
> 
> ----
> enum e = is(typeof(fun!()));
> void fun()() { auto m = MapResult!()(0); }
> alias f = fun!();
> 
> struct MapResult()
> {
>     this(int) {}
>     void front() { undefined(); }
> }
> ----
> 
> Looks similar to issue 16239.
> 
> When the 0 in `MapResult!()(0)` is removed, the program compiles and links
> (with -main). => accepts-invalid

A little further info:

if you remove the enum e line, then compilation fails as expected, complaining
about undefined.

If you change alias f = fun!() to void bar() { fun!(); } then there is no
change (confirming that it's not a question of whether the unused fun
instantiation needs to be emitted)

--


More information about the Digitalmars-d-bugs mailing list