forked from OSchip/llvm-project
Mark declarations as referenced by a default argument in a
potentially-evaluated context. This applies even if the use of the default argument is within an unevaluated context. llvm-svn: 363113
This commit is contained in:
parent
02f0b379f5
commit
7f61d44178
|
@ -4855,6 +4855,8 @@ bool Sema::CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD,
|
|||
// We already type-checked the argument, so we know it works.
|
||||
// Just mark all of the declarations in this potentially-evaluated expression
|
||||
// as being "referenced".
|
||||
EnterExpressionEvaluationContext EvalContext(
|
||||
*this, ExpressionEvaluationContext::PotentiallyEvaluated, Param);
|
||||
MarkDeclarationsReferencedInExpr(Param->getDefaultArg(),
|
||||
/*SkipLocalVariables=*/true);
|
||||
return false;
|
||||
|
|
|
@ -223,3 +223,9 @@ namespace friends {
|
|||
X<int> *p;
|
||||
}
|
||||
}
|
||||
|
||||
namespace unevaluated {
|
||||
int a;
|
||||
template<int = 0> int f(int = a); // expected-warning 0-1{{extension}}
|
||||
int k = sizeof(f());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue