<html>
    <head>
      <base href="http://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 --- - Precompiled header with alias template and decltype in a template class crash clang"
   href="http://llvm.org/bugs/show_bug.cgi?id=18806">18806</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Precompiled header with alias template and decltype in a template class crash clang
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>st@quanttec.com
          </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>Compiling the two simple files below with 

clang++ -std=c++11 -x c++-header -o test.hpp.pch test.hpp
clang++ -std=c++11 -include-pch test.hpp.pch -include test.hpp test.cpp

triggers a crash caused by the following assert error

llvm/tools/clang/lib/AST/ASTContext.cpp:3046: clang::QualType
clang::ASTContext::getSubstTemplateTypeParmType(const
clang::TemplateTypeParmType*, clang::QualType) const: Assertion
`Replacement.isCanonical() && "replacement types must always be canonical"'
failed.

-- test.hpp --
template <typename T>
using Id = T;

template <typename X>
struct Class1 {
private:
  template <typename Y,            
            typename = decltype(Y())>
  struct Nested1;
};

template <typename A>
struct Class2 {
  template <typename B,            
            typename = Id<decltype(B())>>
  struct Nested2;
};

-- test.cpp --
Class2<char> test;</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>