public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/40136] New: Initializing a union whose first member is an anonymous struct
@ 2009-05-13 23:21 markleone at gmail dot com
2009-05-14 0:42 ` [Bug c/40136] " hjl dot tools at gmail dot com
0 siblings, 1 reply; 2+ messages in thread
From: markleone at gmail dot com @ 2009-05-13 23:21 UTC (permalink / raw)
To: gcc-bugs
Not sure if this is a bug or a standards interpretation issue. Consider the
following union, whose first member is an anonymous struct:
union Foo {
struct { float a,b,c; };
const char* x;
};
icc (10.1) permits initialization of the first member of the union:
Foo foo = { .0f, .0f, .0f };
gcc (4.0.1) doesn't permit that, but does permit the following, which I believe
should not be accepted:
Foo foo = { "foo" };
--
Summary: Initializing a union whose first member is an anonymous
struct
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: markleone at gmail dot com
GCC host triplet: i686-apple-darwin9-gcc-4.0.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40136
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/40136] Initializing a union whose first member is an anonymous struct
2009-05-13 23:21 [Bug c/40136] New: Initializing a union whose first member is an anonymous struct markleone at gmail dot com
@ 2009-05-14 0:42 ` hjl dot tools at gmail dot com
0 siblings, 0 replies; 2+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-05-14 0:42 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 734 bytes --]
------- Comment #1 from hjl dot tools at gmail dot com 2009-05-14 00:42 -------
4.0 branch is closed. Gcc 4.1.2 gave
[hjl@gnu-3 tmp]$ cat u.cc
union Foo {
struct { float a,b,c; };
const char* x;
};
Foo foo = { .0f, .0f, .0f };
Foo foo1 = { "foo" };
[hjl@gnu-3 tmp]$ gcc -c u.cc
u.cc:7: error: cannot convert const char* to float in initialization
[hjl@gnu-3 tmp]$
--
hjl dot tools at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |WONTFIX
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40136
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-05-14 0:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-13 23:21 [Bug c/40136] New: Initializing a union whose first member is an anonymous struct markleone at gmail dot com
2009-05-14 0:42 ` [Bug c/40136] " hjl dot tools at gmail dot com
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).