summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx0x-class.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-12-19 06:19:21 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-12-19 06:19:21 +0000
commitd0b4dd656d11d60855bf5b78c7059a3a6c5724d4 (patch)
tree35d257022b6b7e00a6cf5e0cc038a8a1c7b588ac /clang/test/SemaCXX/cxx0x-class.cpp
parentdec792ebb5de0a6b9ff7b9f5ae25682c7031e529 (diff)
downloadbcm5719-llvm-d0b4dd656d11d60855bf5b78c7059a3a6c5724d4.tar.gz
bcm5719-llvm-d0b4dd656d11d60855bf5b78c7059a3a6c5724d4.zip
constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'
variable is initialized by a non-constant expression, and pass in the variable being declared so that earlier-initialized fields' values can be used. Rearrange VarDecl init evaluation to make this possible, and in so doing fix a long-standing issue in our C++ constant expression handling, where we would mishandle cases like: extern const int a; const int n = a; const int a = 5; int arr[n]; Here, n is not initialized by a constant expression, so can't be used in an ICE, even though the initialization expression would be an ICE if it appeared later in the TU. This requires computing whether the initializer is an ICE eagerly, and saving that information in PCH files. llvm-svn: 146856
Diffstat (limited to 'clang/test/SemaCXX/cxx0x-class.cpp')
-rw-r--r--clang/test/SemaCXX/cxx0x-class.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/cxx0x-class.cpp b/clang/test/SemaCXX/cxx0x-class.cpp
index 3527ccb5557..2ceacfc9b2f 100644
--- a/clang/test/SemaCXX/cxx0x-class.cpp
+++ b/clang/test/SemaCXX/cxx0x-class.cpp
@@ -17,12 +17,12 @@ public:
};
namespace rdar8367341 {
- float foo();
+ float foo(); // expected-note {{here}}
struct A {
static const float x = 5.0f; // expected-warning {{GNU extension}} expected-note {{use 'constexpr' specifier to silence this warning}}
static const float y = foo(); // expected-warning {{GNU extension}} expected-note {{use 'constexpr' specifier to silence this warning}} expected-error {{in-class initializer is not a constant expression}}
static constexpr float x2 = 5.0f;
- static constexpr float y2 = foo(); // expected-error {{must be initialized by a constant expression}}
+ static constexpr float y2 = foo(); // expected-error {{must be initialized by a constant expression}} expected-note {{non-constexpr function 'foo'}}
};
}
OpenPOWER on IntegriCloud