public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9621: const int typedef is rejected
@ 2003-02-07 23:56 patrick.rabau
  0 siblings, 0 replies; 8+ messages in thread
From: patrick.rabau @ 2003-02-07 23:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9621
>Category:       c++
>Synopsis:       const int typedef is rejected
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 07 23:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Patrick Rabau
>Release:        gcc 3.2.1
>Organization:
>Environment:
Solaris 8
>Description:
const int typedef T1;

This fails to compile, even though it is legal C++.
The same line without the const is correctly accepted.
  int typedef T2;
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/9621: const int typedef is rejected
@ 2003-02-08 13:26 Falk Hueffner
  0 siblings, 0 replies; 8+ messages in thread
From: Falk Hueffner @ 2003-02-08 13:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9621; it has been noted by GNATS.

From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
To: Gabriel Dos Reis <gdr@integrable-solutions.net>
Cc: Wolfgang Bangerth <bangerth@ticam.utexas.edu>,  gcc-bugs@gcc.gnu.org,
	  <patrick.rabau@gs.com>,  <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/9621: const int typedef is rejected
Date: 08 Feb 2003 14:16:05 +0100

 Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
 
 > Please, don't do that!  Is it an error not to accept
 > 
 >    int const typede T;
 > 
 > It is an error to reject
 > 
 >    int typedef T;
 
 Oh, yes, indeed. I was missing that a decl-specifier can also be a
 type-specifier. Sorry.
 
 -- 
 	Falk


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

* Re: c++/9621: const int typedef is rejected
@ 2003-02-08  4:16 Gabriel Dos Reis
  0 siblings, 0 replies; 8+ messages in thread
From: Gabriel Dos Reis @ 2003-02-08  4:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9621; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>,
   gcc-bugs@gcc.gnu.org, <patrick.rabau@gs.com>, <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/9621: const int typedef is rejected
Date: 08 Feb 2003 05:06:25 +0100

 Wolfgang Bangerth <bangerth@ticam.utexas.edu> writes:
 
 | > >     Can some language lawyer comment on whether and why
 | > >       type1 typedef type2;
 | > >     is legal syntax?
 | > 
 | > No, it isn't. typedef is a decl-specifier. They are only allowed as a
 | > sequence at the start of a simple-declaration:
 | 
 | So it's a bug that gcc accepts it in C++.
 
 *No*.  GCC is correct in accepting it.  That is what C and C++
 standards require.
 
 | I'll change the synopsis of the report in a minute. Thanks for your 
 | clarification.
 
 Please, don't do that!  Is it an error not to accept
 
    int const typede T;
 
 It is an error to reject
 
    int typedef T;
 
 -- Gaby


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

* Re: c++/9621: const int typedef is rejected
@ 2003-02-08  4:06 Gabriel Dos Reis
  0 siblings, 0 replies; 8+ messages in thread
From: Gabriel Dos Reis @ 2003-02-08  4:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9621; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: bangerth@dealii.org
Cc: gcc-bugs@gcc.gnu.org, patrick.rabau@gs.com, gcc-gnats@gcc.gnu.org
Subject: Re: c++/9621: const int typedef is rejected
Date: 08 Feb 2003 05:03:09 +0100

 bangerth@dealii.org writes:
 
 | Synopsis: const int typedef is rejected
 | 
 | State-Changed-From-To: open->feedback
 | State-Changed-By: bangerth
 | State-Changed-When: Sat Feb  8 00:22:54 2003
 | State-Changed-Why:
 |     Fixed in 3.4: it accepts both typedefs.
 |     
 |     I'm surprised that this is legal at all. The standard says
 |     that typedef expressions need to "contain" the typedef
 |     keyword, but the examples only show it as in the form
 |       typedef type1 type2;
 |     
 |     Can some language lawyer comment on whether and why
 |       type1 typedef type2;
 |     is legal syntax?
 
 It is.  See a recent discussion on comp.std.c++ where I gave detailed
 references.  Basically it boils down to the clause 7; section 7.1.
 decl-specifiers can appear in *any* order -- that is one of the reasons
 why grokdeclarator() is so weird.
 
 -- Gaby


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

* Re: c++/9621: const int typedef is rejected
@ 2003-02-08  4:06 Gabriel Dos Reis
  0 siblings, 0 replies; 8+ messages in thread
From: Gabriel Dos Reis @ 2003-02-08  4:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9621; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
Cc: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   nobody@gcc.gnu.org, patrick.rabau@gs.com, gcc-gnats@gcc.gnu.org
Subject: Re: c++/9621: const int typedef is rejected
Date: 08 Feb 2003 05:04:39 +0100

 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de> writes:
 
 | bangerth@dealii.org writes:
 | 
 | > Synopsis: const int typedef is rejected
 | > 
 | > State-Changed-From-To: open->feedback
 | > State-Changed-By: bangerth
 | > State-Changed-When: Sat Feb  8 00:22:54 2003
 | > State-Changed-Why:
 | >     Fixed in 3.4: it accepts both typedefs.
 | >     
 | >     I'm surprised that this is legal at all. The standard says
 | >     that typedef expressions need to "contain" the typedef
 | >     keyword, but the examples only show it as in the form
 | >       typedef type1 type2;
 | >     
 | >     Can some language lawyer comment on whether and why
 | >       type1 typedef type2;
 | >     is legal syntax?
 | 
 | No, it isn't. typedef is a decl-specifier. They are only allowed as a
 | sequence at the start of a simple-declaration:
 
 That is untrue.  Firstly, the syntax is valid.  Secondly "typedef" is
 a decl-specifier and as such can appear in anywhere in the
 decl-specifier-seq.  See 7.
 
 -- Gaby


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

* Re: c++/9621: const int typedef is rejected
@ 2003-02-08  0:56 Wolfgang Bangerth
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Bangerth @ 2003-02-08  0:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9621; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
Cc: gcc-bugs@gcc.gnu.org, <patrick.rabau@gs.com>, <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/9621: const int typedef is rejected
Date: Fri, 7 Feb 2003 18:46:10 -0600 (CST)

 > >     Can some language lawyer comment on whether and why
 > >       type1 typedef type2;
 > >     is legal syntax?
 > 
 > No, it isn't. typedef is a decl-specifier. They are only allowed as a
 > sequence at the start of a simple-declaration:
 
 So it's a bug that gcc accepts it in C++. In a strange sense, it's then 
 even a regression that it previously only accepted the version without 
 "const" and now accepts both with and without const :-)
 
 I'll change the synopsis of the report in a minute. Thanks for your 
 clarification.
 
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 


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

* Re: c++/9621: const int typedef is rejected
@ 2003-02-08  0:46 Falk Hueffner
  0 siblings, 0 replies; 8+ messages in thread
From: Falk Hueffner @ 2003-02-08  0:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9621; it has been noted by GNATS.

From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
To: bangerth@dealii.org
Cc: gcc-bugs@gcc.gnu.org,  gcc-prs@gcc.gnu.org,  nobody@gcc.gnu.org,
	  patrick.rabau@gs.com,  gcc-gnats@gcc.gnu.org
Subject: Re: c++/9621: const int typedef is rejected
Date: 08 Feb 2003 01:42:45 +0100

 bangerth@dealii.org writes:
 
 > Synopsis: const int typedef is rejected
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: bangerth
 > State-Changed-When: Sat Feb  8 00:22:54 2003
 > State-Changed-Why:
 >     Fixed in 3.4: it accepts both typedefs.
 >     
 >     I'm surprised that this is legal at all. The standard says
 >     that typedef expressions need to "contain" the typedef
 >     keyword, but the examples only show it as in the form
 >       typedef type1 type2;
 >     
 >     Can some language lawyer comment on whether and why
 >       type1 typedef type2;
 >     is legal syntax?
 
 No, it isn't. typedef is a decl-specifier. They are only allowed as a
 sequence at the start of a simple-declaration:
 
 simple-declaration:
              decl-specifier-seq[opt] init-declarator-list[opt] ;
 
 IIRC, in C it is legal (typedef is a storage class specifier there;
 the use of a storage class specifier not at the start of a declaration
 is considered obsolecent, though).
 
 -- 
 	Falk


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

* Re: c++/9621: const int typedef is rejected
@ 2003-02-08  0:22 bangerth
  0 siblings, 0 replies; 8+ messages in thread
From: bangerth @ 2003-02-08  0:22 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, patrick.rabau

Synopsis: const int typedef is rejected

State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Sat Feb  8 00:22:54 2003
State-Changed-Why:
    Fixed in 3.4: it accepts both typedefs.
    
    I'm surprised that this is legal at all. The standard says
    that typedef expressions need to "contain" the typedef
    keyword, but the examples only show it as in the form
      typedef type1 type2;
    
    Can some language lawyer comment on whether and why
      type1 typedef type2;
    is legal syntax?
    
    It's also accepted by the C frontend, by the way.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9621


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

end of thread, other threads:[~2003-02-08 13:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-07 23:56 c++/9621: const int typedef is rejected patrick.rabau
2003-02-08  0:22 bangerth
2003-02-08  0:46 Falk Hueffner
2003-02-08  0:56 Wolfgang Bangerth
2003-02-08  4:06 Gabriel Dos Reis
2003-02-08  4:06 Gabriel Dos Reis
2003-02-08  4:16 Gabriel Dos Reis
2003-02-08 13:26 Falk Hueffner

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