public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50169] New: "new struct X {{}};" incorrectly treated as an invalid struct-definition
@ 2011-08-23 20:48 schaub.johannes at googlemail dot com
2011-08-23 21:31 ` [Bug c++/50169] " ville.voutilainen at gmail dot com
0 siblings, 1 reply; 2+ messages in thread
From: schaub.johannes at googlemail dot com @ 2011-08-23 20:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50169
Bug #: 50169
Summary: "new struct X {{}};" incorrectly treated as an invalid
struct-definition
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: schaub.johannes@googlemail.com
The following looks like valid code:
struct A { int a; };
int main() {
new struct A {{ }};
}
The type-specifier-seq "struct A" is followed by a braced-init-list "{{}}". But
GCC says:
main1.cpp: In function 'int main()':
main1.cpp:3:16: error: types may not be defined in a new-type-id
main1.cpp:3:17: error: expected unqualified-id before '{' token
As far as I can see, I would only define a new type if I would say:
new struct A { };
But the two-braces disambiguates it.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/50169] "new struct X {{}};" incorrectly treated as an invalid struct-definition
2011-08-23 20:48 [Bug c++/50169] New: "new struct X {{}};" incorrectly treated as an invalid struct-definition schaub.johannes at googlemail dot com
@ 2011-08-23 21:31 ` ville.voutilainen at gmail dot com
0 siblings, 0 replies; 2+ messages in thread
From: ville.voutilainen at gmail dot com @ 2011-08-23 21:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50169
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ville.voutilainen at gmail
| |dot com
--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> 2011-08-23 21:22:39 UTC ---
Trying
struct A { int a; };
int main() {
new (struct A) {{ }};
}
gives
internal compiler error: in cxx_eval_bare_aggregate, at cp/semantics.c:6601
This works fine:
struct A { int a; };
int main() {
new (struct A) { };
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-23 21:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-23 20:48 [Bug c++/50169] New: "new struct X {{}};" incorrectly treated as an invalid struct-definition schaub.johannes at googlemail dot com
2011-08-23 21:31 ` [Bug c++/50169] " ville.voutilainen 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).