diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2015-04-10 04:52:06 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2015-04-10 04:52:06 +0000 |
| commit | bd38544c0a19aaa1554f9be93e5ff22e2f358cbd (patch) | |
| tree | 95713060c45facc5cfb58c053b70899c51e9265e /clang/test/SemaCXX/functional-cast.cpp | |
| parent | 6f1ffc069ba68660eb8fe4acde450c7964f8958e (diff) | |
| download | bcm5719-llvm-bd38544c0a19aaa1554f9be93e5ff22e2f358cbd.tar.gz bcm5719-llvm-bd38544c0a19aaa1554f9be93e5ff22e2f358cbd.zip | |
[Sema] Don't assume that an initializer list has an initializer
Given something like 'int({}, 1)', we would try to emit a diagnostic
regarding the excess element in the scalar initializer. However, we
assumed that the initializer list had an element in it.
llvm-svn: 234565
Diffstat (limited to 'clang/test/SemaCXX/functional-cast.cpp')
| -rw-r--r-- | clang/test/SemaCXX/functional-cast.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/functional-cast.cpp b/clang/test/SemaCXX/functional-cast.cpp index f5ca76c38c0..9db95e80d03 100644 --- a/clang/test/SemaCXX/functional-cast.cpp +++ b/clang/test/SemaCXX/functional-cast.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // REQUIRES: LP64 // ------------ not interpreted as C-style cast ------------ @@ -11,7 +11,7 @@ struct InitViaConstructor { InitViaConstructor(int i = 7); }; -struct NoValueInit { // expected-note 2 {{candidate constructor (the implicit copy constructor)}} +struct NoValueInit { // expected-note 2 {{candidate constructor (the implicit copy constructor)}} expected-note 2 {{candidate constructor (the implicit move constructor)}} NoValueInit(int i, int j); // expected-note 2 {{candidate constructor}} }; @@ -25,6 +25,7 @@ void test_cxx_function_cast_multi() { (void)NoValueInit(0, 0); (void)NoValueInit(0, 0, 0); // expected-error{{no matching constructor for initialization}} (void)int(1, 2); // expected-error{{excess elements in scalar initializer}} + (void)int({}, 2); // expected-error{{excess elements in scalar initializer}} } |

