Index: include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -1981,8 +1981,6 @@ "declaration of variable %0 with deduced type %1 requires an initializer">; def err_auto_new_requires_ctor_arg : Error< "new expression for type %0 requires a constructor argument">; -def err_auto_new_list_init : Error< - "new expression for type %0 cannot use list-initialization">; def err_auto_var_init_no_expression : Error< "initializer for variable %0 with type %1 is empty">; def err_auto_var_init_multiple_expressions : Error< Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -1748,14 +1748,16 @@ if (AllocType.isNull()) return ExprError(); } else if (Deduced) { + if (NumInits == 1) { + if (auto p = dyn_cast_or_null(Inits[0])) { + Inits = p->getInits(); + NumInits = p->getNumInits(); + } + } + if (initStyle == CXXNewExpr::NoInit || NumInits == 0) return ExprError(Diag(StartLoc, diag::err_auto_new_requires_ctor_arg) << AllocType << TypeRange); - if (initStyle == CXXNewExpr::ListInit || - (NumInits == 1 && isa(Inits[0]))) - return ExprError(Diag(Inits[0]->getLocStart(), - diag::err_auto_new_list_init) - << AllocType << TypeRange); if (NumInits > 1) { Expr *FirstBad = Inits[1]; return ExprError(Diag(FirstBad->getLocStart(), Index: test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp =================================================================== --- test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp +++ test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp @@ -9,12 +9,14 @@ void f() { only p = new const auto (0); only q = new (auto) (0.0); + only r = new auto {'a'}; new auto; // expected-error{{new expression for type 'auto' requires a constructor argument}} new (const auto)(); // expected-error{{new expression for type 'const auto' requires a constructor argument}} new (auto) (1,2,3); // expected-error{{new expression for type 'auto' contains multiple constructor arguments}} - new auto {1,2,3}; // expected-error{{new expression for type 'auto' cannot use list-initialization}} - new auto ({1,2,3}); // expected-error{{new expression for type 'auto' cannot use list-initialization}} + new auto {}; // expected-error{{new expression for type 'auto' requires a constructor argument}} + new auto {1,2,3}; // expected-error{{new expression for type 'auto' contains multiple constructor arguments}} + new auto ({1,2,3}); // expected-error{{new expression for type 'auto' contains multiple constructor arguments}} } void p2example() { Index: test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp =================================================================== --- test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp +++ test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -148,7 +148,7 @@ } void dangle() { - new auto{1, 2, 3}; // expected-error {{cannot use list-initialization}} + new auto{1, 2, 3}; // expected-error {{new expression for type 'auto' contains multiple constructor arguments}} new std::initializer_list{1, 2, 3}; // expected-warning {{at the end of the full-expression}} }