<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 --- - Clang crashes on lambdas with arguments of invalid types derived from template arguments"
   href="http://llvm.org/bugs/show_bug.cgi?id=21484">21484</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang crashes on lambdas with arguments of invalid types derived from template arguments
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rtrieu@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Code:
template<class T>
void bar(T t) {
  auto x = [](typename T::ns::type &k) {}; 
}

class S {};

void foo() {
  bar(5);
  bar(S());
}

Commandline:
clang -std=c++11 test.cc

Error:
bar(5) produces:
test.cc:3:24: error: type 'int' cannot be used prior to '::' because it has no
      members
  auto x = [](typename T::ns::type &k) {};
                       ^
test.cc:9:3: note: in instantiation of function template specialization
      'bar<int>' requested here
  bar(5);
  ^

bar(S()) [with bar(5) commented out] produces:
test.cc:3:27: error: no member named 'ns' in 'S'
  auto x = [](typename T::ns::type &k) {};
                       ~~~^
test.cc:10:3: note: in instantiation of function template specialization
      'bar<S>' requested here
  bar(S());
  ^

Assertion:
clang-3.6: ../tools/clang/lib/Sema/TypeLocBuilder.h:106: clang::TypeSourceInfo
*clang::TypeLocBuilder::getTypeSourceInfo(clang::ASTContext &,
clang::QualType): Assertion `T == LastTy && "type doesn't match last type
pushed!"' failed.

QualType T in the assertion is a null QualType.

I suspect that TransformLambdaExpr (which calls getTypeSoucreInfo at lint 9017
and triggers the assertion) is not handling invalid types properly along all
paths.</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>