[Issue 19126] Compiler removes inout on templated parameter and then complains it's not there

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 3 09:23:09 UTC 2018


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

--- Comment #8 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Ali Ak from comment #7)
> Wait how does wrap1 suffer form it? wrap1 compiles fine?

It compiles fine because it returns it's parameter without specifying inout.
Essentially, the instantiated function looks like this:

auto wrap1(immutable(int) t) {
   return t;
}

> And if this is not a bug a more diagnostic, what should the error message be
> here?

It is a bug that has diagnostic problems. I put the diagnostic tag in because
it's telling you something that is false.

What could be done is adding a note to the error like "Note:
inout(immutable(int)) is reduced to immutable(int)" when an inout error such as
the above occurs.

If we simply got rid of the restriction, everything gets better.

--


More information about the Digitalmars-d-bugs mailing list