<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - failure to resolve nested class template after befriending it"
   href="https://llvm.org/bugs/show_bug.cgi?id=26938">26938</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>failure to resolve nested class template after befriending it
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>llvm@fortitu.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
00560a217508ec5553150bb43269359ded932a88) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
a4bfc57321dbb6d712297822e6be9855c1bf8791)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>