On Mon, 18 Jun 2018 at 12:09, Jonathan Wakely wrote:
>
> This is not the right place for bug reports. Please use the gcc-help
> list or Bugzilla.
>
> The most likely scenario is that GCC is performing an implicit
> conversion from pointer to some class type (like an iterator) and then
> converting that to a reference. Or the function template is not being
> called.

It's never called.

I added a call to abort() to that function, and the tests all pass. So
the function is never used, so GCC never compiles it and doesn't
notice that the return type is invalid. That's allowed by the
standard. The compiler is not required to diagnose ill-formed code in
uninstantiated templates.

Reply via email to