summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/constexpr-value-init.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-07-23 05:16:10 +0000
committerNico Weber <nicolasweber@gmx.de>2014-07-23 05:16:10 +0000
commit9386c82d56745579e86ddbe3a37bea6604658c6a (patch)
tree894b6be722ed322ff5aef62d6afc279d735afe4b /clang/test/SemaCXX/constexpr-value-init.cpp
parentbb3d7b5e81c92b44f6c2db8ba6a0533cb558458c (diff)
downloadbcm5719-llvm-9386c82d56745579e86ddbe3a37bea6604658c6a.tar.gz
bcm5719-llvm-9386c82d56745579e86ddbe3a37bea6604658c6a.zip
Improve diagnostic on default-initializing const variables (PR20208).
This tweaks the diagnostic wording slighly, and adds a fixit on a note. An alternative would be to add the fixit directly on the diagnostic, see the review thread linked to from the bug for a few notes on that approach. llvm-svn: 213725
Diffstat (limited to 'clang/test/SemaCXX/constexpr-value-init.cpp')
-rw-r--r--clang/test/SemaCXX/constexpr-value-init.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/test/SemaCXX/constexpr-value-init.cpp b/clang/test/SemaCXX/constexpr-value-init.cpp
index 9ad11290190..3657c18ddba 100644
--- a/clang/test/SemaCXX/constexpr-value-init.cpp
+++ b/clang/test/SemaCXX/constexpr-value-init.cpp
@@ -14,7 +14,7 @@ void f() {
constexpr A a; // expected-error {{constant expression}} expected-note {{in call to 'A()'}}
}
-constexpr B b1; // expected-error {{requires a user-provided default constructor}}
+constexpr B b1; // expected-error {{without a user-provided default constructor}} expected-note {{add an explicit initializer to initialize 'b1'}}
constexpr B b2 = B(); // ok
static_assert(b2.a.a == 1, "");
static_assert(b2.a.b == 2, "");
@@ -23,9 +23,9 @@ struct C {
int c;
};
struct D : C { int d; };
-constexpr C c1; // expected-error {{requires a user-provided default constructor}}
+constexpr C c1; // expected-error {{without a user-provided default constructor}} expected-note{{add an explicit initializer to initialize 'c1'}}
constexpr C c2 = C(); // ok
-constexpr D d1; // expected-error {{requires a user-provided default constructor}}
+constexpr D d1; // expected-error {{without a user-provided default constructor}} expected-note{{add an explicit initializer to initialize 'd1'}}
constexpr D d2 = D(); // ok with DR1452
static_assert(D().c == 0, "");
static_assert(D().d == 0, "");
OpenPOWER on IntegriCloud