summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-12-25 21:17:58 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-12-25 21:17:58 +0000
commitf0215fe89839624a9a5fd68ca73861c245f3af40 (patch)
treed380bc6b44744c73aa11b7cf7eb3df5b08aa2ee3 /clang/test
parentc1faeac410b3891483ec0aabeec5b047472a4409 (diff)
downloadbcm5719-llvm-f0215fe89839624a9a5fd68ca73861c245f3af40.tar.gz
bcm5719-llvm-f0215fe89839624a9a5fd68ca73861c245f3af40.zip
Fix constexpr handling to allow 'extern constexpr' variable declarations. We no
longer have access to the source locations we need to produce the 'replace constexpr with const' fixits, so they're gone for now. llvm-svn: 147273
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/FixIt/fixit-cxx0x.cpp35
-rw-r--r--clang/test/SemaCXX/constant-expression-cxx11.cpp10
2 files changed, 10 insertions, 35 deletions
diff --git a/clang/test/FixIt/fixit-cxx0x.cpp b/clang/test/FixIt/fixit-cxx0x.cpp
index 9fb647d03fc..b2b69b6f4b7 100644
--- a/clang/test/FixIt/fixit-cxx0x.cpp
+++ b/clang/test/FixIt/fixit-cxx0x.cpp
@@ -18,41 +18,6 @@ using ::T = void; // expected-error {{name defined in alias declaration must be
using typename U = void; // expected-error {{name defined in alias declaration must be an identifier}}
using typename ::V = void; // expected-error {{name defined in alias declaration must be an identifier}}
-namespace Constexpr {
- extern constexpr int a; // expected-error {{must be a definition}}
- // -> extern const int a;
-
- extern constexpr int *b; // expected-error {{must be a definition}}
- // -> extern int *const b;
-
- extern constexpr int &c; // expected-error {{must be a definition}}
- // -> extern int &b;
-
- extern constexpr const int d; // expected-error {{must be a definition}}
- // -> extern const int d;
-
- int z;
- constexpr int a = 0;
- constexpr int *b = &z;
- constexpr int &c = z;
- constexpr int d = a;
-
- // FIXME: Provide FixIts for static data members too.
-#if 0
- struct S {
- static constexpr int b; // xpected-error {{requires an initializer}}
- // -> const int b;
- };
-
- constexpr int S::b = 0;
-#endif
-
- struct S {
- static char *const p = 0; // expected-error {{requires 'constexpr' specifier}}
- // -> constexpr static char *const p = 0;
- };
-}
-
namespace SemiCommaTypo {
int m {},
n [[]], // expected-error {{expected ';' at end of declaration}}
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp
index 0993a982d8e..d78c16cca62 100644
--- a/clang/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp
@@ -961,3 +961,13 @@ struct S {
};
}
+
+namespace ExternConstexpr {
+ extern constexpr int n = 0;
+ extern constexpr int m; // expected-error {{constexpr variable declaration must be a definition}}
+ void f() {
+ extern constexpr int i; // expected-error {{constexpr variable declaration must be a definition}}
+ constexpr int j = 0;
+ constexpr int k; // expected-error {{default initialization of an object of const type}}
+ }
+}
OpenPOWER on IntegriCloud