aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2017-09-15 19:22:35 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2017-09-15 19:22:35 +0000
commitc01df3c86f72656e44ec1952b4e8019961ed7a4a (patch)
treed7b3d9d98a3f57cfbabaddeef8fe87934bfe6ae0 /gcc
parent39ebef2cf14836141586d27e7b9c2660ab5490b1 (diff)
downloadgcc-c01df3c86f72656e44ec1952b4e8019961ed7a4a.zip
gcc-c01df3c86f72656e44ec1952b4e8019961ed7a4a.tar.gz
gcc-c01df3c86f72656e44ec1952b4e8019961ed7a4a.tar.bz2
re PR c++/64644 ("warning: anonymous union with no members" should be an error with -pedantic-errors)
/cp 2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org> Paolo Carlini <paolo.carlini@oracle.com> PR c++/64644 * decl2.c (finish_anon_union): Complain about "anonymous union with no members" with a pedwarn. /testsuite 2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org> Paolo Carlini <paolo.carlini@oracle.com> PR c++/64644 * g++.dg/other/anon-union4.C: New. * g++.old-deja/g++.law/union4.C: Adjust. * g++.old-deja/g++.other/anon1.C: Likewise. Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com> From-SVN: r252835
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/g++.dg/other/anon-union4.C3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/union4.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/anon1.C2
6 files changed, 21 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c013225..b43f042 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/64644
+ * decl2.c (finish_anon_union): Complain about "anonymous union with
+ no members" with a pedwarn.
+
2017-09-15 Bernd Edlinger <bernd.edlinger@hotmail.de>
* typeck.c (build_reinterpret_cast_1,
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 2bde588..03e91b7 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1546,7 +1546,7 @@ finish_anon_union (tree anon_union_decl)
return;
if (main_decl == NULL_TREE)
{
- warning (0, "anonymous union with no members");
+ pedwarn (input_location, 0, "anonymous union with no members");
return;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0091855..57425159 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/64644
+ * g++.dg/other/anon-union4.C: New.
+ * g++.old-deja/g++.law/union4.C: Adjust.
+ * g++.old-deja/g++.other/anon1.C: Likewise.
+
2017-09-15 Bernd Edlinger <bernd.edlinger@hotmail.de>
* c-c++-common/Wcast-align.c: New test.
diff --git a/gcc/testsuite/g++.dg/other/anon-union4.C b/gcc/testsuite/g++.dg/other/anon-union4.C
new file mode 100644
index 0000000..043c208
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/anon-union4.C
@@ -0,0 +1,3 @@
+// PR c++/64644
+
+static union { }; // { dg-error "anonymous union with no members" }
diff --git a/gcc/testsuite/g++.old-deja/g++.law/union4.C b/gcc/testsuite/g++.old-deja/g++.law/union4.C
index f48ceee..958ff0a 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/union4.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/union4.C
@@ -10,4 +10,4 @@ static union {
struct SS {
int ss;
};
-};// { dg-warning "no members" }
+};// { dg-error "no members" }
diff --git a/gcc/testsuite/g++.old-deja/g++.other/anon1.C b/gcc/testsuite/g++.old-deja/g++.other/anon1.C
index 5886b1a..70ae600 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/anon1.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/anon1.C
@@ -3,4 +3,4 @@
static union {
union {
};
-}; // { dg-warning "" } anonymous union with no members
+}; // { dg-error "" } anonymous union with no members