diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 7 | ||||
-rw-r--r-- | clang/test/SemaCXX/condition.cpp | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 56cf5d4fd37..cc2a11fccfb 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -14394,7 +14394,12 @@ Sema::ConditionResult Sema::ActOnCondition(Scope *S, SourceLocation Loc, if (Cond.isInvalid()) return ConditionError(); - return ConditionResult(*this, nullptr, MakeFullExpr(Cond.get(), Loc), + // FIXME: FullExprArg doesn't have an invalid bit, so check nullness instead. + FullExprArg FullExpr = MakeFullExpr(Cond.get(), Loc); + if (!FullExpr.get()) + return ConditionError(); + + return ConditionResult(*this, nullptr, FullExpr, CK == ConditionKind::ConstexprIf); } diff --git a/clang/test/SemaCXX/condition.cpp b/clang/test/SemaCXX/condition.cpp index b757fcb8cd5..5596564d248 100644 --- a/clang/test/SemaCXX/condition.cpp +++ b/clang/test/SemaCXX/condition.cpp @@ -65,3 +65,7 @@ void test5() { void test5_inst() { test5<int>(); } + +void PR28373() { + if (!x) {} // expected-error {{undeclared}} +} |