[llvm-bugs] [Bug 35377] New: no diagnostic issued for invalid friend declaration involving dependent member of the current instantiation

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 21 15:05:09 PST 2017


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

            Bug ID: 35377
           Summary: no diagnostic issued for invalid friend declaration
                    involving dependent member of the current
                    instantiation
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Testcase (inspired by testcase for gcc.gnu.org/PR65157):

template<typename T> struct A {
  struct B;
  template<typename U> struct C;
};

template <typename T>
struct A<T>::B {
  template<typename U> void f();
};

template<typename T> template <typename U>
struct A<T>::C {
 friend void B::f<U>();
};

template<> struct A<int>::B {};
A<int>::C<int> c;


This crashes during IR generation. The root cause is that the friend
declaration was marked invalid without any diagnostic being issued. It *is*
invalid (we aren't supposed to be looking up things within B, because it's a
dependent type, so it can't be given template arguments with <...>), but we
should actually produce an error saying so.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171121/477d09a3/attachment.html>


More information about the llvm-bugs mailing list