diff options
Diffstat (limited to 'test/SemaCXX/return.cpp')
-rw-r--r-- | test/SemaCXX/return.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/SemaCXX/return.cpp b/test/SemaCXX/return.cpp index 98dbd51f5806..8c1664516a71 100644 --- a/test/SemaCXX/return.cpp +++ b/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'}} +} |