public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/40076]  New: g++ should not permit types to be defined in compound literals
@ 2009-05-08 21:36 ian at airs dot com
  2009-05-08 21:42 ` [Bug c++/40076] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: ian at airs dot com @ 2009-05-08 21:36 UTC (permalink / raw)
  To: gcc-bugs

This is invalid C++:

struct s1 { int i; } *p;
int i = ((struct s2 { int j; } *)p)->j;

foo.cc:2: error: types may not be defined in casts

By analogy, this should be invalid C++:

int i = (struct s3 { int j; }) { 1 }.j;

Currently g++ accepts it.  Compound literals are an extension to C++, so there
are no documented rules about them.  However, it seems to be that when it comes
to defining new types, they should be consistent with casts.


-- 
           Summary: g++ should not permit types to be defined in compound
                    literals
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ian at airs dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40076


^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <bug-40076-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2012-05-02 20:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-08 21:36 [Bug c++/40076] New: g++ should not permit types to be defined in compound literals ian at airs dot com
2009-05-08 21:42 ` [Bug c++/40076] " pinskia at gcc dot gnu dot org
2009-05-08 21:51 ` pinskia at gcc dot gnu dot org
2009-05-08 22:19 ` ian at airs dot com
     [not found] <bug-40076-4@http.gcc.gnu.org/bugzilla/>
2012-05-02 20:04 ` manu at gcc dot gnu.org
2012-05-02 20:14 ` joseph at codesourcery dot com
2012-05-02 20:21 ` manu 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).