diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-01-15 03:51:30 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-01-15 03:51:30 +0000 |
commit | 244ee7b89a483fd3764637abdf95de2893b437d0 (patch) | |
tree | b9a100ef2aedd776604c0199e746cbb73718971c /test/SemaCXX | |
parent | 28c1ce789322ab99f9b5887015d63ec5f088957a (diff) | |
download | clang-244ee7b89a483fd3764637abdf95de2893b437d0.tar.gz |
Pedantic diagnostic correction: in C++, we have integral constant expressions,
not integer constant expressions. In passing, fix the 'folding is an extension'
diagnostic to not claim we're accepting the code, since that's not true in
-pedantic-errors mode, and add this diagnostic to -Wgnu.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148209 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/constant-expression-cxx11.cpp | 17 | ||||
-rw-r--r-- | test/SemaCXX/constant-expression.cpp | 8 | ||||
-rw-r--r-- | test/SemaCXX/enum-bitfield.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/enum.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/i-c-e-cxx.cpp | 2 |
5 files changed, 15 insertions, 16 deletions
diff --git a/test/SemaCXX/constant-expression-cxx11.cpp b/test/SemaCXX/constant-expression-cxx11.cpp index e20f8f32b5..b1b4f38a4b 100644 --- a/test/SemaCXX/constant-expression-cxx11.cpp +++ b/test/SemaCXX/constant-expression-cxx11.cpp @@ -93,7 +93,7 @@ namespace CaseStatements { void f(int n) { switch (n) { // FIXME: Produce the 'add ()' fixit for this. - case MemberZero().zero: // desired-error {{did you mean to call it with no arguments?}} expected-error {{not an integer constant expression}} expected-note {{non-literal type '<bound member function type>'}} + case MemberZero().zero: // desired-error {{did you mean to call it with no arguments?}} expected-error {{not an integral constant expression}} expected-note {{non-literal type '<bound member function type>'}} case id(1): return; } @@ -299,27 +299,26 @@ constexpr S* sptr = &s; constexpr bool dyncast = sptr == dynamic_cast<S*>(sptr); // expected-error {{constant expression}} expected-note {{dynamic_cast}} struct Str { - // FIXME: In C++ mode, we should say 'integral' not 'integer' int a : dynamic_cast<S*>(sptr) == dynamic_cast<S*>(sptr); // \ - expected-warning {{not integer constant expression}} \ + expected-warning {{not an integral constant expression}} \ expected-note {{dynamic_cast is not allowed in a constant expression}} int b : reinterpret_cast<S*>(sptr) == reinterpret_cast<S*>(sptr); // \ - expected-warning {{not integer constant expression}} \ + expected-warning {{not an integral constant expression}} \ expected-note {{reinterpret_cast is not allowed in a constant expression}} int c : (S*)(long)(sptr) == (S*)(long)(sptr); // \ - expected-warning {{not integer constant expression}} \ + expected-warning {{not an integral constant expression}} \ expected-note {{cast which performs the conversions of a reinterpret_cast is not allowed in a constant expression}} int d : (S*)(42) == (S*)(42); // \ - expected-warning {{not integer constant expression}} \ + expected-warning {{not an integral constant expression}} \ expected-note {{cast which performs the conversions of a reinterpret_cast is not allowed in a constant expression}} int e : (Str*)(sptr) == (Str*)(sptr); // \ - expected-warning {{not integer constant expression}} \ + expected-warning {{not an integral constant expression}} \ expected-note {{cast which performs the conversions of a reinterpret_cast is not allowed in a constant expression}} int f : &(Str&)(*sptr) == &(Str&)(*sptr); // \ - expected-warning {{not integer constant expression}} \ + expected-warning {{not an integral constant expression}} \ expected-note {{cast which performs the conversions of a reinterpret_cast is not allowed in a constant expression}} int g : (S*)(void*)(sptr) == sptr; // \ - expected-warning {{not integer constant expression}} \ + expected-warning {{not an integral constant expression}} \ expected-note {{cast from 'void *' is not allowed in a constant expression}} }; diff --git a/test/SemaCXX/constant-expression.cpp b/test/SemaCXX/constant-expression.cpp index 061e77591b..23a4dda708 100644 --- a/test/SemaCXX/constant-expression.cpp +++ b/test/SemaCXX/constant-expression.cpp @@ -88,10 +88,10 @@ enum { void diags(int n) { switch (n) { - case (1/0, 1): // expected-error {{not an integer constant expression}} expected-note {{division by zero}} - case (int)(1/0, 2.0): // expected-error {{not an integer constant expression}} expected-note {{division by zero}} - case __imag(1/0): // expected-error {{not an integer constant expression}} expected-note {{division by zero}} - case (int)__imag((double)(1/0)): // expected-error {{not an integer constant expression}} expected-note {{division by zero}} + case (1/0, 1): // expected-error {{not an integral constant expression}} expected-note {{division by zero}} + case (int)(1/0, 2.0): // expected-error {{not an integral constant expression}} expected-note {{division by zero}} + case __imag(1/0): // expected-error {{not an integral constant expression}} expected-note {{division by zero}} + case (int)__imag((double)(1/0)): // expected-error {{not an integral constant expression}} expected-note {{division by zero}} ; } } diff --git a/test/SemaCXX/enum-bitfield.cpp b/test/SemaCXX/enum-bitfield.cpp index 1a657408f8..831b982511 100644 --- a/test/SemaCXX/enum-bitfield.cpp +++ b/test/SemaCXX/enum-bitfield.cpp @@ -14,5 +14,5 @@ struct X { struct Y { enum E : int(2); - enum E : Z(); // expected-error{{not an integer constant}} + enum E : Z(); // expected-error{{not an integral constant}} }; diff --git a/test/SemaCXX/enum.cpp b/test/SemaCXX/enum.cpp index b4a050cb09..370e1c34d2 100644 --- a/test/SemaCXX/enum.cpp +++ b/test/SemaCXX/enum.cpp @@ -88,7 +88,7 @@ typedef enum { }; // expected-warning{{typedef requires a name}} // PR7921 enum PR7921E { - PR7921V = (PR7921E)(123) // expected-error {{expression is not an integer constant expression}} + PR7921V = (PR7921E)(123) // expected-error {{expression is not an integral constant expression}} }; void PR8089() { diff --git a/test/SemaCXX/i-c-e-cxx.cpp b/test/SemaCXX/i-c-e-cxx.cpp index 47a47b5e2f..0bfd221a4c 100644 --- a/test/SemaCXX/i-c-e-cxx.cpp +++ b/test/SemaCXX/i-c-e-cxx.cpp @@ -18,7 +18,7 @@ void f() { int a() { const int t=t; // expected-note {{declared here}} switch(1) { // expected-warning {{no case matching constant switch condition '1'}} - case t:; // expected-error {{not an integer constant expression}} expected-note {{initializer of 't' is not a constant expression}} + case t:; // expected-error {{not an integral constant expression}} expected-note {{initializer of 't' is not a constant expression}} } } |