public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/62202] New: g++ does not accept typedef-name after struct even if -fpermissive is used
@ 2014-08-20 12:36 bugzilla@poradnik-webmastera.com
  2021-08-10  0:21 ` [Bug c++/62202] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: bugzilla@poradnik-webmastera.com @ 2014-08-20 12:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62202

            Bug ID: 62202
           Summary: g++ does not accept typedef-name after struct even if
                    -fpermissive is used
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bugzilla@poradnik-webmastera.com

gcc silently compiles this, even with -Wall -Wextra -pedantic:

struct test_s { int n; };
typedef struct test_s test_t;
typedef struct test_t* something_t;
int main() { return 0; }

g++ reports following error even if -fpermissive option is used:
test.c:3:16: error: using typedef-name ‘test_t’ after ‘struct’
 typedef struct test_t* something_t;
                ^
test.c:2:23: note: ‘test_t’ has a previous declaration here
 typedef struct test_s test_t;
                       ^
test.c:3:35: error: invalid type in declaration before ‘;’ token
 typedef struct test_t* something_t;
                                   ^

Please extend permissive mode to accept such case too. Also consider printing
warning when compiling C code.
>From gcc-bugs-return-458863-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 20 12:49:01 2014
Return-Path: <gcc-bugs-return-458863-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11316 invoked by alias); 20 Aug 2014 12:49:00 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 11241 invoked by uid 55); 20 Aug 2014 12:48:52 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/59304] #pragma diagnostic pop after warning fails for options unspecified in the command-line and disabled by default
Date: Wed, 20 Aug 2014 12:49:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords: patch
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59304-4-DhMRK47vIA@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59304-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59304-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg01360.txt.bz2
Content-length: 883

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59304

--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Author: manu
Date: Wed Aug 20 12:48:16 2014
New Revision: 214221

URL: https://gcc.gnu.org/viewcvs?rev=214221&root=gcc&view=rev
Log:
gcc/ChangeLog:

2014-08-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR c/59304
    * opts-common.c (set_option): Call diagnostic_classify_diagnostic
    before setting the option.
    * diagnostic.c (diagnostic_classify_diagnostic): Record
    command-line status.

gcc/testsuite/ChangeLog:

2014-08-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR c/59304
    * gcc.dg/pr59304.c: New test.



Added:
    trunk/gcc/testsuite/gcc.dg/pr59304.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/diagnostic.c
    trunk/gcc/opts-common.c
    trunk/gcc/testsuite/ChangeLog
>From gcc-bugs-return-458864-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 20 12:50:37 2014
Return-Path: <gcc-bugs-return-458864-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 12284 invoked by alias); 20 Aug 2014 12:50:36 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 12213 invoked by uid 48); 20 Aug 2014 12:50:33 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/59304] #pragma diagnostic pop after warning fails for options unspecified in the command-line and disabled by default
Date: Wed, 20 Aug 2014 12:50:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords: patch
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-59304-4-sCBOLD8SdW@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59304-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59304-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg01361.txt.bz2
Content-length: 475

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59304

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Fixed in gcc 5.0
>From gcc-bugs-return-458865-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 20 12:50:37 2014
Return-Path: <gcc-bugs-return-458865-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 12427 invoked by alias); 20 Aug 2014 12:50:37 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 12247 invoked by uid 48); 20 Aug 2014 12:50:34 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/58876] No non-virtual-dtor warning in std::unique_ptr
Date: Wed, 20 Aug 2014 12:50:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: redi at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-58876-4-R5GfnEzLog@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58876-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58876-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg01362.txt.bz2
Content-length: 533

https://gcc.gnu.org/bugzilla/show_bug.cgi?idX876
Bug 58876 depends on bug 59304, which changed state.

Bug 59304 Summary: #pragma diagnostic pop after warning fails for options unspecified in the command-line and disabled by default
https://gcc.gnu.org/bugzilla/show_bug.cgi?idY304

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED


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

* [Bug c++/62202] g++ does not accept typedef-name after struct even if -fpermissive is used
  2014-08-20 12:36 [Bug c++/62202] New: g++ does not accept typedef-name after struct even if -fpermissive is used bugzilla@poradnik-webmastera.com
@ 2021-08-10  0:21 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-10  0:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62202

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
         Resolution|---                         |WONTFIX
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
C is not C++ :).
Note for the C front-end we do warn if you have -Wc++-compat on there (since
4.5.0 which was released over 11 years ago):
<source>:4:16: warning: using 'test_t' as both a typedef and a tag is invalid
in C++ [-Wc++-compat]
    4 | typedef struct test_t* something_t;
      |                ^~~~~~
<source>:3:23: note: originally defined here
    3 | typedef struct test_s test_t;
      |                       ^~~~~~

Since we already have an option to warn about this in the C front-end, I am
just close this as won't fix.

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

end of thread, other threads:[~2021-08-10  0:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 12:36 [Bug c++/62202] New: g++ does not accept typedef-name after struct even if -fpermissive is used bugzilla@poradnik-webmastera.com
2021-08-10  0:21 ` [Bug c++/62202] " pinskia at gcc dot gnu.org

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).