Summary:
`OpaqueValueExpr`s may not have a source expression (as in the case when
they are created due to a default argument error).
This can cause an assertion failure in `TransformOpaqueValueExpr` during
template instantiation.
This patch fixes the assertion failure.
Reviewers: hfinkel, rsmith
Subscribers: fraggamuffin, cfe-commits
Differential Revision: http://reviews.llvm.org/D11582
Patch by Rachel Craik!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246600
91177308-0d34-0410-b5e6-
96231b3b80d8
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformOpaqueValueExpr(OpaqueValueExpr *E) {
- assert(getDerived().AlreadyTransformed(E->getType()) &&
+ assert((!E->getSourceExpr() || getDerived().AlreadyTransformed(E->getType())) &&
"opaque value expression requires transformation");
return E;
}
}
template void f1<int>(); // expected-note{{in instantiation of function template specialization 'NondefDecls::f1<int>' requested here}}
}
+
+template <typename T>
+struct C {
+ C(T t = ); // expected-error {{expected expression}}
+};
+C<int> obj;