public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20064] New: Types shall not be defined in casts in the strict mode.
@ 2005-02-19 2:39 msadoghi at ca dot ibm dot com
2005-02-19 3:29 ` [Bug c++/20064] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: msadoghi at ca dot ibm dot com @ 2005-02-19 2:39 UTC (permalink / raw)
To: gcc-bugs
Sourc code for t.cpp:
------------------------------------------------
int mymain()
{
void *p = (void *)(struct {int i;} *)0; /* error - can't define a type in a cast */
return 0;
}
------------------------------------------------
Expected Behaviour:
------------------------------------------------
t.cpp:3: error: ISO C++ forbids defining types within cast
------------------------------------------------
Actual Behaviour:
------------------------------------------------
t.cpp:3: warning: ISO C++ forbids defining types within cast
------------------------------------------------
t.ii generated with -save-temps option
------------------------------------------------
# 1 "t.cpp"
# 1 "t.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "t.cpp"
int mymain()
{
void *p = (void *)(struct {int i;} *)0;
return 0;
}
------------------------------------------------
Release:
------------------------------------------------
GCC Version: 3.2.0
------------------------------------------------
Environment:
System Type:
------------------------------------------------
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
/usr/libexec/gcc/darwin/ppc/3.3/cc1plus -E -D__GNUG__=3 -quiet -v -D__GNUC__=3
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__APPLE_CC__=1495 -D__DYNAMIC__
/home/msadoghi/scenario/common/t.cpp -fPIC -std=iso9899:199409 -pedantic
-D__private_extern__=extern t.ii
cc1plus: warning: "-std=iso9899:199409" is valid for C/ObjC but not for C++
ignoring nonexistent directory "/usr/ppc-darwin/include"
ignoring nonexistent directory "/Local/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/gcc/darwin/3.3/c++
/usr/include/gcc/darwin/3.3/c++/ppc-darwin
/usr/include/gcc/darwin/3.3/c++/backward
/usr/local/include
/usr/include/gcc/darwin/3.3
/usr/include
End of search list.
Framework search starts here:
/System/Library/Frameworks
/Library/Frameworks
End of framework search list.
/usr/libexec/gcc/darwin/ppc/3.3/cc1plus -fpreprocessed t.ii -fPIC -quiet
-dumpbase t.cpp -auxbase t -pedantic -std=iso9899:199409 -version
-D__private_extern__=extern -o t.s
cc1plus: warning: "-std=iso9899:199409" is valid for C/ObjC but not for C++
GNU C++ version 3.3 20030304 (Apple Computer, Inc. build 1495) (ppc-darwin)
compiled by GNU C version 3.3 20030304 (Apple Computer, Inc. build 1495).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=131072
/home/msadoghi/scenario/common/t.cpp: In function `int mymain()':
/home/msadoghi/scenario/common/t.cpp:3: warning: ISO C++ forbids defining types
within cast
/usr/libexec/gcc/darwin/ppc/as -arch ppc -o t.o t.s
------------------------------------------------
How-To-Repeat:
------------------------------------------------
g++ -v -save-temps -c -std=iso9899:199409 -pedantic t.cpp
------------------------------------------------
Note:
------------------------------------------------
This is a diagnostic test case. Compilation failure is expected on the strict mode,
where type is defined in a cast.
C++ ANSI Standard:
"Types shall not be defined in casts in the strict mode."
AIX, MACOS and LINUX all have a similar behaviors.
------------------------------------------------
--
Summary: Types shall not be defined in casts in the strict mode.
Product: gcc
Version: 3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: msadoghi at ca dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20064
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/20064] Types shall not be defined in casts in the strict mode.
2005-02-19 2:39 [Bug c++/20064] New: Types shall not be defined in casts in the strict mode msadoghi at ca dot ibm dot com
@ 2005-02-19 3:29 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-19 3:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-18 21:29 -------
There are two things here, -pedantic does not enable strict mode, just the warnings for strict mode,
use -pedantic-errors instead.
Anyways this is rejected by default with 3.4.0 and above.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |3.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20064
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-02-18 21:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-19 2:39 [Bug c++/20064] New: Types shall not be defined in casts in the strict mode msadoghi at ca dot ibm dot com
2005-02-19 3:29 ` [Bug c++/20064] " pinskia at gcc dot gnu dot 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).