<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 --- - ICE on use of alias template resulting in array type nested within class template" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24212&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=MmwxEhd6n-m47g-xRqMjMc1E9wQrYrKuhdT2TUE-jKQ&s=og7EcGWeKxYNEwINfGXjB6whsS93VsGPjxcmSuaDA20&e=">24212</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ICE on use of alias template resulting in array type nested within class template
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.7
          </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>C++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ed@catmur.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following program crashes clang++ (versions up to 3.7):

template<int I>
struct S {
  template<int J> using T = int[J];
  using U = T<I>;
};
S<3>::U a;

UNREACHABLE executed!
0  libLLVM-3.4.so  0x00007f7e80d695d2 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1  libLLVM-3.4.so  0x00007f7e80d69dfa
2  libpthread.so.0 0x00007f7e7fbc8710
3  libc.so.6       0x00007f7e7e87e625 gsignal + 53
4  libc.so.6       0x00007f7e7e87fe05 abort + 373
5  libLLVM-3.4.so  0x00007f7e80d549c4 llvm::llvm_unreachable_internal(char
const*, char const*, unsigned int) + 356
6  clang           0x00000000007aaa1f
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) + 415
7  clang           0x00000000007ab30e
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType) + 30
8  clang           0x0000000000759d0b
clang::CodeGen::CodeGenModule::EmitNullConstant(clang::QualType) + 187
9  clang           0x0000000000790c8f
clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*) +
1487
10 clang           0x000000000079613f
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 159
11 clang           0x000000000079668d
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 941
12 clang           0x000000000079699b
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 299
13 clang           0x000000000073c0bb
14 clang           0x000000000073b349
15 clang           0x00000000008c9e67 clang::ParseAST(clang::Sema&, bool, bool)
+ 487
16 clang           0x000000000073ab46 clang::CodeGenAction::ExecuteAction() +
70
17 clang           0x00000000005bccf2 clang::FrontendAction::Execute() + 210
18 clang           0x00000000005982cd
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 285
19 clang           0x000000000057dc5a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1642
20 clang           0x0000000000573bc0 cc1_main(char const**, char const**, char
const*, void*) + 1184
21 clang           0x000000000057c264 main + 7636
22 libc.so.6       0x00007f7e7e86ad5d __libc_start_main + 253
23 clang           0x0000000000573529

Interestingly, supplying an equivalent alias template at (any) namespace scope
suppresses the bug:

namespace magic { template<int I> using unused = int[I]; }
template<int I>
struct S {
  template<int J> using T = int[J];
  using U = T<I>;
};
S<3>::U a; // OK</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>