aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2013-11-17 19:22:43 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2013-11-17 19:22:43 +0000
commitcce9196f4d5173e382b8e31eae1671fa1f302188 (patch)
tree483fcf1dc18945fe85a739b84937042cd4f208c3 /gcc
parenta788747592b6d2d80ce20d8b1f1f3582ac80d4b7 (diff)
downloadgcc-cce9196f4d5173e382b8e31eae1671fa1f302188.zip
gcc-cce9196f4d5173e382b8e31eae1671fa1f302188.tar.gz
gcc-cce9196f4d5173e382b8e31eae1671fa1f302188.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c8
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-decl.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-redeclaration1.C10
5 files changed, 28 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5f52d90..2729ec3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+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>
PR c++/29143
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 7d9d5df..34d73be 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1216,10 +1216,12 @@ validate_constexpr_redeclaration (tree old_decl, tree new_decl)
if (! DECL_TEMPLATE_SPECIALIZATION (old_decl)
&& DECL_TEMPLATE_SPECIALIZATION (new_decl))
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);
- error ("from previous declaration %q+D", old_decl);
- return false;
+ return true;
}
#define GNU_INLINE_P(fn) (DECL_DECLARED_INLINE_P (fn) \
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3f7e1be..c58adf9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+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>
PR c++/29143
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-decl.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-decl.C
index 1af0662..f16f12c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-decl.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-decl.C
@@ -3,8 +3,7 @@
struct S {
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;
-constexpr int S::size = 256; // { dg-error "" }
+constexpr int S::size = 256;
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-redeclaration1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-redeclaration1.C
new file mode 100644
index 0000000..6010b20
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-redeclaration1.C
@@ -0,0 +1,10 @@
+// PR c++/59123
+// { dg-do compile { target c++11 } }
+
+// Fwd-declarations
+struct S;
+extern const S s;
+
+// (... later) definitions
+struct S {};
+constexpr S s {};