forked from OSchip/llvm-project
Reapply 81096, now with a fix. Spot the bug:
for (unsigned i = numargs; i < NumArgs; ++i) Args[0] = 0; ;) llvm-svn: 81123
This commit is contained in:
parent
6bd6a72e73
commit
faf1ced5ee
|
@ -403,6 +403,8 @@ CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
|
|||
Args = new (C) Stmt*[NumArgs];
|
||||
for (unsigned i = 0; i < numargs; ++i)
|
||||
Args[i] = args[i];
|
||||
for (unsigned i = numargs; i < NumArgs; ++i)
|
||||
Args[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2899,8 +2899,8 @@ bool Sema::InitializeVarWithConstructor(VarDecl *VD,
|
|||
QualType DeclInitType,
|
||||
Expr **Exprs, unsigned NumExprs) {
|
||||
OwningExprResult TempResult =
|
||||
BuildCXXConstructExpr(/*FIXME: ConstructLoc*/ SourceLocation(),
|
||||
DeclInitType, Constructor, Exprs, NumExprs);
|
||||
BuildCXXConstructExpr(VD->getLocation(), DeclInitType, Constructor,
|
||||
Exprs, NumExprs);
|
||||
if (TempResult.isInvalid())
|
||||
return true;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ void g() {
|
|||
}
|
||||
|
||||
template<typename T> struct F {
|
||||
F(T t = 10);
|
||||
F(T t = 10); // expected-error{{cannot initialize 't' with an rvalue of type 'int'}}
|
||||
void f(T t = 10); // expected-error{{cannot initialize 't' with an rvalue of type 'int'}}
|
||||
};
|
||||
|
||||
|
@ -34,6 +34,9 @@ void g2() {
|
|||
void g3(F<int> f, F<struct S> s) {
|
||||
f.f();
|
||||
s.f(); // expected-note{{in instantiation of default function argument expression for 'f<struct S>' required here}}
|
||||
|
||||
F<int> f2;
|
||||
F<S> s2; // expected-note{{in instantiation of default function argument expression for 'F<struct S>' required here}}
|
||||
}
|
||||
|
||||
template<typename T> struct G {
|
||||
|
|
Loading…
Reference in New Issue