diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5311649d12d..279e91b92f0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2014-11-15 Jason Merrill + + * constexpr.c (cx_check_missing_mem_inits): Clarify error message. + 2014-11-14 Paolo Carlini * semantics.c (end_maybe_infinite_loop): Use fold_non_dependent_expr. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index d30bf635d84..0d45f31f48a 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -716,8 +716,9 @@ cx_check_missing_mem_inits (tree fun, tree body, bool complain) } if (!complain) return true; - error ("uninitialized member %qD in % constructor", - field); + error ("member %qD must be initialized by mem-initializer " + "in % constructor", field); + inform (DECL_SOURCE_LOCATION (field), "declared here"); bad = true; } if (field == NULL_TREE) diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor.C index 659e733cdcd..55beda7c49f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor.C @@ -3,5 +3,5 @@ struct A { int i; - constexpr A() { } // { dg-error "uninitialized member .A::i" } + constexpr A() { } // { dg-error "A::i" } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag4.C index 29f574df389..13ca6fa2390 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag4.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag4.C @@ -21,5 +21,5 @@ struct A1 struct B1 { A1 a1; - constexpr B1() {} // { dg-error "uninitialized member" } + constexpr B1() {} // { dg-error "B1::a1" } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C index 3e2685b1c5c..a5893563eec 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C @@ -6,7 +6,7 @@ struct A { int i; - constexpr A(int _i) { i = _i; } // { dg-error "empty body|uninitialized member" } + constexpr A(int _i) { i = _i; } // { dg-error "empty body|A::i" } }; template diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-template2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-template2.C index a316b34bd7b..12a8d42b31f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-template2.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-template2.C @@ -3,7 +3,7 @@ template struct A { T t; - constexpr A() { } // { dg-error "uninitialized" } + constexpr A() { } // { dg-error "::t" } }; int main() diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi3.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi3.C index 6ac414b7437..d2e74392487 100644 --- a/gcc/testsuite/g++.dg/cpp0x/nsdmi3.C +++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi3.C @@ -15,4 +15,4 @@ struct B constexpr B b; // { dg-error "B::B" } -// { dg-prune-output "uninitialized member" } +// { dg-prune-output "B::a1" }