<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Can't find previous declaration of a template class friend declaration"
   href="https://bugs.llvm.org/show_bug.cgi?id=32189">32189</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Can't find previous declaration of a template class friend declaration
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>janus926@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The minimal code for reproducing:

  namespace X {
    template<class T>
    class A
    {
    };
  }

  template<class T>
  class B
  {
    template<class U> friend class ::X::A;
  };

Using command:

  clang.exe -Xclang -ast-dump -fsyntax-only test.cpp

r286542 has previous declaration of class A for the friend declaration:

  TranslationUnitDecl 0x1ffc2c75d20 <<invalid sloc>> <invalid sloc>
  |-TypedefDecl 0x1ffc2c762b0 <<invalid sloc>> <invalid sloc> implicit
__int128_t '__int128'
  | `-BuiltinType 0x1ffc2c75f90 '__int128'
  |-TypedefDecl 0x1ffc2c76318 <<invalid sloc>> <invalid sloc> implicit
__uint128_t 'unsigned __int128'
  | `-BuiltinType 0x1ffc2c75fb0 'unsigned __int128'
  |-TypedefDecl 0x1ffc2c76678 <<invalid sloc>> <invalid sloc> implicit
__NSConstantString 'struct __NSConstantString_tag'
  | `-RecordType 0x1ffc2c76400 'struct __NSConstantString_tag'
  |   `-CXXRecord 0x1ffc2c76368 '__NSConstantString_tag'
  |-CXXRecordDecl 0x1ffc2c766c8 <<invalid sloc>> <invalid sloc> implicit class
type_info
  | `-TypeVisibilityAttr 0x1ffc2c76780 <<invalid sloc>> Implicit Default
  |-TypedefDecl 0x1ffc2c767e0 <<invalid sloc>> <invalid sloc> implicit size_t
'unsigned long long'
  | `-BuiltinType 0x1ffc2c75ef0 'unsigned long long'
  |-TypedefDecl 0x1ffc2c76870 <<invalid sloc>> <invalid sloc> implicit
__builtin_ms_va_list 'char *'
  | `-PointerType 0x1ffc2c76830 'char *'
  |   `-BuiltinType 0x1ffc2c75db0 'char'
  |-TypedefDecl 0x1ffc2c768d8 <<invalid sloc>> <invalid sloc> implicit
__builtin_va_list 'char *'
  | `-PointerType 0x1ffc2c76830 'char *'
  |   `-BuiltinType 0x1ffc2c75db0 'char'
  |-NamespaceDecl 0x1ffc2c76928 <test.cpp:1:1, line:6:1> line:1:11 X
  | `-ClassTemplateDecl 0x1ffc2ccf358 <line:2:3, line:5:3> line:3:9 A
  |   |-TemplateTypeParmDecl 0x1ffc2c76990 <line:2:12, col:18> col:18 class T
  |   `-CXXRecordDecl 0x1ffc2ccf2c0 <line:3:3, line:5:3> line:3:9 class A
definition
  |     `-CXXRecordDecl 0x1ffc2ccf5c8 <col:3, col:9> col:9 implicit class A
  `-ClassTemplateDecl 0x1ffc2ccf7a8 <line:8:1, line:12:1> line:9:7 B
    |-TemplateTypeParmDecl 0x1ffc2ccf680 <line:8:10, col:16> col:16 class T
    `-CXXRecordDecl 0x1ffc2ccf710 <line:9:1, line:12:1> line:9:7 class B
definition
      |-CXXRecordDecl 0x1ffc2ccfa18 <col:1, col:7> col:7 implicit class B
      `-FriendDecl 0x1ffc2ccfcd8 <line:11:3, col:39> col:39
        `-ClassTemplateDecl 0x1ffc2ccfc68 parent 0x1ffc2c76928 prev
0x1ffc2ccf358 <col:3, col:39> col:39 A
          |-TemplateTypeParmDecl 0x1ffc2ccfab0 <col:12, col:18> col:18 class U
          `-CXXRecordDecl 0x1ffc2ccfba0 parent 0x1ffc2c76928 prev 0x1ffc2ccf2c0
<col:28, col:39> col:39 class A

r292767 does not:

  TranslationUnitDecl 0x189f677bac0 <<invalid sloc>> <invalid sloc>
  |-TypedefDecl 0x189f677c050 <<invalid sloc>> <invalid sloc> implicit
__int128_t '__int128'
  | `-BuiltinType 0x189f677bd30 '__int128'
  |-TypedefDecl 0x189f677c0b8 <<invalid sloc>> <invalid sloc> implicit
__uint128_t 'unsigned __int128'
  | `-BuiltinType 0x189f677bd50 'unsigned __int128'
  |-TypedefDecl 0x189f677c418 <<invalid sloc>> <invalid sloc> implicit
__NSConstantString 'struct __NSConstantString_tag'
  | `-RecordType 0x189f677c1a0 'struct __NSConstantString_tag'
  |   `-CXXRecord 0x189f677c108 '__NSConstantString_tag'
  |-CXXRecordDecl 0x189f677c468 <<invalid sloc>> <invalid sloc> implicit class
type_info
  | `-TypeVisibilityAttr 0x189f677c520 <<invalid sloc>> Implicit Default
  |-TypedefDecl 0x189f677c580 <<invalid sloc>> <invalid sloc> implicit size_t
'unsigned long long'
  | `-BuiltinType 0x189f677bc90 'unsigned long long'
  |-TypedefDecl 0x189f677c610 <<invalid sloc>> <invalid sloc> implicit
__builtin_ms_va_list 'char *'
  | `-PointerType 0x189f677c5d0 'char *'
  |   `-BuiltinType 0x189f677bb50 'char'
  |-TypedefDecl 0x189f677c678 <<invalid sloc>> <invalid sloc> implicit
__builtin_va_list 'char *'
  | `-PointerType 0x189f677c5d0 'char *'
  |   `-BuiltinType 0x189f677bb50 'char'
  |-NamespaceDecl 0x189f677c6c8 <test.cpp:1:1, line:6:1> line:1:11 X
  | `-ClassTemplateDecl 0x189f67d4a98 <line:2:3, line:5:3> line:3:9 A
  |   |-TemplateTypeParmDecl 0x189f677c730 <line:2:12, col:18> col:18 class T
  |   `-CXXRecordDecl 0x189f67d4a00 <line:3:3, line:5:3> line:3:9 class A
definition
  |     `-CXXRecordDecl 0x189f67d4d08 <col:3, col:9> col:9 implicit class A
  `-ClassTemplateDecl 0x189f67d4ee8 <line:8:1, line:12:1> line:9:7 B
    |-TemplateTypeParmDecl 0x189f67d4dc0 <line:8:10, col:16> col:16 class T
    `-CXXRecordDecl 0x189f67d4e50 <line:9:1, line:12:1> line:9:7 class B
definition
      |-CXXRecordDecl 0x189f67d5158 <col:1, col:7> col:7 implicit class B
      `-FriendDecl 0x189f67d55d8 <line:11:3, col:39> col:39
        `-ClassTemplateDecl 0x189f67d53a8 parent 0x189f677c6c8 <col:3, col:39>
col:39 A
          |-TemplateTypeParmDecl 0x189f67d51f0 <col:12, col:18> col:18 class U
          `-CXXRecordDecl 0x189f67d52e0 parent 0x189f677c6c8 <col:28, col:39>
col:39 class A

I don't know this starts from which revision, but r292767 is the earliest one I
have on my machine.</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>