Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5669,7 +5669,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
};
Function->setDeclarationNameLoc(NameLocPointsToPattern());

EnterExpressionEvaluationContext EvalContext(
EnterExpressionEvaluationContextForFunction EvalContext(
*this, Sema::ExpressionEvaluationContext::PotentiallyEvaluated);

Qualifiers ThisTypeQuals;
Expand Down
16 changes: 16 additions & 0 deletions clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,21 @@ void f2() {

}

namespace GH153884 {
bool f1() {
auto f = [](auto) { return true; };
if constexpr (0)
return f(1);
return false;
}
bool f2() {
auto f = [](auto x) { if (x) return 1.5; else return "wat"; };
// expected-error@-1 {{'auto' in return type deduced as 'const char *' here but deduced as 'double' in earlier return statement}}
if constexpr (0)
return f(1);
// expected-note@-1 {{in instantiation of function template specialization 'GH153884::f2()}}
return false;
}
}

#endif