Commit cce9196f by Paolo Carlini Committed by Paolo Carlini

re PR c++/59123 ([c++11] can't forward-declare an object later defined constexpr)

/cp
2013-11-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/59123
	* decl.c (validate_constexpr_redeclaration): Redeclarations of
	variables can differ in constexpr.

/testsuite
2013-11-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/59123
	* g++.dg/cpp0x/constexpr-redeclaration1.C: New.
	* g++.dg/cpp0x/constexpr-decl.C: Adjust.

From-SVN: r204923
parent a7887475
2013-11-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59123
* decl.c (validate_constexpr_redeclaration): Redeclarations of
variables can differ in constexpr.
2013-11-16 Paolo Carlini <paolo.carlini@oracle.com> 2013-11-16 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/29143 PR c++/29143
......
...@@ -1216,10 +1216,12 @@ validate_constexpr_redeclaration (tree old_decl, tree new_decl) ...@@ -1216,10 +1216,12 @@ validate_constexpr_redeclaration (tree old_decl, tree new_decl)
if (! DECL_TEMPLATE_SPECIALIZATION (old_decl) if (! DECL_TEMPLATE_SPECIALIZATION (old_decl)
&& DECL_TEMPLATE_SPECIALIZATION (new_decl)) && DECL_TEMPLATE_SPECIALIZATION (new_decl))
return true; return true;
error ("redeclaration %qD differs in %<constexpr%>", new_decl);
error ("from previous declaration %q+D", old_decl);
return false;
} }
error ("redeclaration %qD differs in %<constexpr%>", new_decl); return true;
error ("from previous declaration %q+D", old_decl);
return false;
} }
#define GNU_INLINE_P(fn) (DECL_DECLARED_INLINE_P (fn) \ #define GNU_INLINE_P(fn) (DECL_DECLARED_INLINE_P (fn) \
......
2013-11-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59123
* g++.dg/cpp0x/constexpr-redeclaration1.C: New.
* g++.dg/cpp0x/constexpr-decl.C: Adjust.
2013-11-16 Paolo Carlini <paolo.carlini@oracle.com> 2013-11-16 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/29143 PR c++/29143
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
struct S { struct S {
static constexpr int size; // { dg-error "must have an initializer" "must have" } static constexpr int size; // { dg-error "must have an initializer" "must have" }
// { dg-error "previous declaration" "previous" { target *-*-* } 5 }
}; };
const int limit = 2 * S::size; const int limit = 2 * S::size;
constexpr int S::size = 256; // { dg-error "" } constexpr int S::size = 256;
// PR c++/59123
// { dg-do compile { target c++11 } }
// Fwd-declarations
struct S;
extern const S s;
// (... later) definitions
struct S {};
constexpr S s {};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment