https://llvm.org/bugs/show_bug.cgi?id=27544

Richard Smith <richard-l...@metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-l...@metafoo.co.uk
         Resolution|---                         |INVALID

--- Comment #1 from Richard Smith <richard-l...@metafoo.co.uk> ---
This code is ill-formed.

In order for 'gun<T>' to be parsed as a template-id, there must be a
declaration of a template named 'gun' visible to name lookup, and there is not.

The problem is that GCC's name lookup has a bug where it incorrectly injects
friend function templates into the surrounding scope. Try this:

  struct bar {
    friend void f(int) {}
    template<typename T> friend void g(T) {}
  };
  int main() {
    f(0);
    g(0);
  }

All versions of GCC that I tested reject the call to 'f'.

Versions of GCC prior to 5.0 incorrectly accept the call to 'g'.
GCC 5.x rejects the call to 'g' but produces a bogus typo correction from 'g'
to 'g'. Whatever it's still getting wrong here leads to it accepting your
original testcase.
GCC 6.x properly rejects both calls and your original testcase.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to