summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/return.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2015-01-04 20:32:12 +0000
committerNico Weber <nicolasweber@gmx.de>2015-01-04 20:32:12 +0000
commit49e6bc024d0269f580e8601aecf17eaf5537df50 (patch)
tree3b13a6f2eceb700c87a1fc68bec60c3a5bb12dd3 /clang/test/SemaCXX/return.cpp
parent1e94ef5bd09cc47f335d26a98469ca70c4226900 (diff)
downloadbcm5719-llvm-49e6bc024d0269f580e8601aecf17eaf5537df50.tar.gz
bcm5719-llvm-49e6bc024d0269f580e8601aecf17eaf5537df50.zip
Remove an assert that's not true on invalid code.
r185773 added an assert that checked that a CXXUnresolvedConstructExpr either has a valid rparen, or exactly one argument. This doesn't have to be true for invalid inputs. Convert the assert to an if, and add a test for this case. Found by SLi's afl bot. llvm-svn: 225140
Diffstat (limited to 'clang/test/SemaCXX/return.cpp')
-rw-r--r--clang/test/SemaCXX/return.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/return.cpp b/clang/test/SemaCXX/return.cpp
index 98dbd51f580..8c1664516a7 100644
--- a/clang/test/SemaCXX/return.cpp
+++ b/clang/test/SemaCXX/return.cpp
@@ -112,3 +112,11 @@ namespace ctor_returns_void {
~S() { return f(); } // expected-error {{destructor '~S' must not return void expression}}
};
}
+
+void cxx_unresolved_expr() {
+ // The use of an undeclared variable tricks clang into building a
+ // CXXUnresolvedConstructExpr, and the missing ')' gives it an invalid source
+ // location for its rparen. Check that emitting a diag on the range of the
+ // expr doesn't assert.
+ return int(undeclared, 4; // expected-error {{expected ')'}} expected-note{{to match this '('}} expected-error {{void function 'cxx_unresolved_expr' should not return a value}} expected-error {{use of undeclared identifier 'undeclared'}}
+}
OpenPOWER on IntegriCloud