ASTOwningVector<Expr*> InitArgs(SemaRef);
if (!InstantiateInitializer(SemaRef, D->getInit(), TemplateArgs, LParenLoc,
InitArgs, RParenLoc)) {
- // Attach the initializer to the declaration.
- if (D->hasCXXDirectInitializer()) {
+ // Attach the initializer to the declaration, if we have one.
+ if (InitArgs.size() == 0)
+ SemaRef.ActOnUninitializedDecl(Var, false);
+ else if (D->hasCXXDirectInitializer()) {
// Add the direct initializer to the declaration.
SemaRef.AddCXXDirectInitializerToDecl(Var,
LParenLoc,
move_arg(InitArgs),
RParenLoc);
- } else if (InitArgs.size() == 1) {
+ } else {
+ assert(InitArgs.size() == 1);
Expr *Init = InitArgs.take()[0];
SemaRef.AddInitializerToDecl(Var, Init, false);
- } else {
- assert(InitArgs.size() == 0);
- SemaRef.ActOnUninitializedDecl(Var, false);
}
} else {
// FIXME: Not too happy about invalidating the declaration
template void initializer_list_expansion<1, 2, 3, 4, 5>();
template void initializer_list_expansion<1, 2, 3, 4, 5, 6>(); // expected-note{{in instantiation of function template specialization 'initializer_list_expansion<1, 2, 3, 4, 5, 6>' requested here}}
+namespace PR8977 {
+ struct A { };
+ template<typename T, typename... Args> void f(Args... args) {
+ T t(args...);
+ };
+
+ template void f<A>();
+}
+
// In a base-specifier-list (Clause 10); the pattern is a base-specifier.
template<typename ...Mixins>
struct HasMixins : public Mixins... {