[llvm-bugs] [Bug 26938] New: failure to resolve nested class template after befriending it

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 14 10:17:16 PDT 2016


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

            Bug ID: 26938
           Summary: failure to resolve nested class template after
                    befriending it
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm at fortitu.de
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

clang 3.8 and trunk (r263425) fail to compile the following code snippet.
Recent clang versions up to 3.7 and all major gcc versions from 4.0 till 5.2
compile the code without warnings.
(The testcase was reduced mostly with creduce from the polymake source)

Removing the friend statement in 'struct A' fixes the error, alternatively
removing the forward declaration of 'Y' fixes it as well.

// code
template <typename> struct X {
  template <typename> struct Y;
  struct A {
    template <typename> friend struct Y;
  };
  template <typename> struct Y { };
};
template <typename>
struct B : X<int>::template Y<int> { } ;


$ clang++ -c bug.cc
bug.cc:9:29: error: 'Y' following the 'template' keyword does not refer to a
template
struct B : X<int>::template Y<int> { } ;
                   ~~~~~~~~ ^
bug.cc:9:30: error: expected class name
struct B : X<int>::template Y<int> { } ;
                             ^
2 errors generated.


$ clang++ -v
clang version 3.9.0 (http://llvm.org/git/clang.git
00560a217508ec5553150bb43269359ded932a88) (http://llvm.org/git/llvm.git
a4bfc57321dbb6d712297822e6be9855c1bf8791)

-- 
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/20160314/cb0cac0d/attachment.html>


More information about the llvm-bugs mailing list