public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 64644 (""warning: anonymous union with no members" should be an error with -pedantic-errors")
@ 2017-06-16 13:47 Paolo Carlini
  2017-07-10 14:40 ` Paolo Carlini
  2017-09-15  9:53 ` [C++ Patch Ping] " Paolo Carlini
  0 siblings, 2 replies; 4+ messages in thread
From: Paolo Carlini @ 2017-06-16 13:47 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

Hi,

submitter and Manuel analyzed this a while ago and came to the 
conclusion - which I think is still valid vs the current working draft - 
that strictly speaking this kind of code violates [dcl.dcl], thus a 
pedwarn seems more suited than a plain warning. The below one-liner, 
suggested by Manuel at the time, passes testing on x86_64-linux together 
with my testsuite changes.

Thanks,

Paolo.

//////////////////////


[-- Attachment #2: CL_64644 --]
[-- Type: text/plain, Size: 465 bytes --]

/cp
2017-06-16  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-06-16  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.

[-- Attachment #3: patch_64644 --]
[-- Type: text/plain, Size: 1533 bytes --]

Index: cp/decl2.c
===================================================================
--- cp/decl2.c	(revision 249233)
+++ cp/decl2.c	(working copy)
@@ -1559,7 +1559,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;
     }
 
Index: testsuite/g++.dg/other/anon-union4.C
===================================================================
--- testsuite/g++.dg/other/anon-union4.C	(revision 0)
+++ testsuite/g++.dg/other/anon-union4.C	(working copy)
@@ -0,0 +1,3 @@
+// PR c++/64644
+
+static union { };  // { dg-error "anonymous union with no members" }
Index: testsuite/g++.old-deja/g++.law/union4.C
===================================================================
--- testsuite/g++.old-deja/g++.law/union4.C	(revision 249233)
+++ testsuite/g++.old-deja/g++.law/union4.C	(working copy)
@@ -10,4 +10,4 @@ static union {
         struct SS {
                 int ss;
         };
-};// { dg-warning "no members" }
+};// { dg-error "no members" }
Index: testsuite/g++.old-deja/g++.other/anon1.C
===================================================================
--- testsuite/g++.old-deja/g++.other/anon1.C	(revision 249233)
+++ testsuite/g++.old-deja/g++.other/anon1.C	(working copy)
@@ -3,4 +3,4 @@
 static union {
   union {
   };
-}; // { dg-warning "" } anonymous union with no members
+}; // { dg-error "" } anonymous union with no members

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [C++ Patch] PR 64644 (""warning: anonymous union with no members" should be an error with -pedantic-errors")
  2017-06-16 13:47 [C++ Patch] PR 64644 (""warning: anonymous union with no members" should be an error with -pedantic-errors") Paolo Carlini
@ 2017-07-10 14:40 ` Paolo Carlini
  2017-09-15  9:53 ` [C++ Patch Ping] " Paolo Carlini
  1 sibling, 0 replies; 4+ messages in thread
From: Paolo Carlini @ 2017-07-10 14:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

Hi,

gently pinging this. As you can see certainly isn't an high priority 
issue but resolving it one way or the other seems pretty simple...

On 16/06/2017 15:47, Paolo Carlini wrote:
> Hi,
>
> submitter and Manuel analyzed this a while ago and came to the 
> conclusion - which I think is still valid vs the current working draft 
> - that strictly speaking this kind of code violates [dcl.dcl], thus a 
> pedwarn seems more suited than a plain warning. The below one-liner, 
> suggested by Manuel at the time, passes testing on x86_64-linux 
> together with my testsuite changes.

     https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01193.html

Thanks!
Paolo.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [C++ Patch Ping] PR 64644 (""warning: anonymous union with no members" should be an error with -pedantic-errors")
  2017-06-16 13:47 [C++ Patch] PR 64644 (""warning: anonymous union with no members" should be an error with -pedantic-errors") Paolo Carlini
  2017-07-10 14:40 ` Paolo Carlini
@ 2017-09-15  9:53 ` Paolo Carlini
  2017-09-15 15:59   ` Nathan Sidwell
  1 sibling, 1 reply; 4+ messages in thread
From: Paolo Carlini @ 2017-09-15  9:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

Hi,

gently pinging this.

On 16/06/2017 15:47, Paolo Carlini wrote:
> Hi,
>
> submitter and Manuel analyzed this a while ago and came to the 
> conclusion - which I think is still valid vs the current working draft 
> - that strictly speaking this kind of code violates [dcl.dcl], thus a 
> pedwarn seems more suited than a plain warning. The below one-liner, 
> suggested by Manuel at the time, passes testing on x86_64-linux 
> together with my testsuite changes.

     https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01193.html

Thanks!
Paolo.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [C++ Patch Ping] PR 64644 (""warning: anonymous union with no members" should be an error with -pedantic-errors")
  2017-09-15  9:53 ` [C++ Patch Ping] " Paolo Carlini
@ 2017-09-15 15:59   ` Nathan Sidwell
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Sidwell @ 2017-09-15 15:59 UTC (permalink / raw)
  To: Paolo Carlini, gcc-patches; +Cc: Jason Merrill

On 09/15/2017 05:53 AM, Paolo Carlini wrote:
> Hi,
> 
> gently pinging this.
> 
> On 16/06/2017 15:47, Paolo Carlini wrote:
>> Hi,
>>
>> submitter and Manuel analyzed this a while ago and came to the 
>> conclusion - which I think is still valid vs the current working draft 
>> - that strictly speaking this kind of code violates [dcl.dcl], thus a 
>> pedwarn seems more suited than a plain warning. The below one-liner, 
>> suggested by Manuel at the time, passes testing on x86_64-linux 
>> together with my testsuite changes.
> 
>      https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01193.html

Ok.  class.union.anon has the member-specification as non-optional.

nathan

-- 
Nathan Sidwell

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-15 15:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-16 13:47 [C++ Patch] PR 64644 (""warning: anonymous union with no members" should be an error with -pedantic-errors") Paolo Carlini
2017-07-10 14:40 ` Paolo Carlini
2017-09-15  9:53 ` [C++ Patch Ping] " Paolo Carlini
2017-09-15 15:59   ` Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).