public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23959] New: -Wswitch-default reports missing default in a template that has one
@ 2005-09-19 2:34 rlibiez at arthmoor dot com
2005-09-19 2:35 ` [Bug c++/23959] " rlibiez at arthmoor dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: rlibiez at arthmoor dot com @ 2005-09-19 2:34 UTC (permalink / raw)
To: gcc-bugs
-Wswitch default warning flag is producing a warning message saying that a
template does not have a default case even though it does.
GCC version specs:
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux
Thread model: posix
gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)
Installed via RPM package from Fedora Core 4
Command line: g++ -o test test.c -Wswitch-default -Wall --pedantic
Compiler output:
test.c: In function 'void foo(ArrayType*)':
test.c:12: warning: switch missing default case
Detailed output:
g++ -v -save-temps -Wswitch-default -Wall --pedantic -o test test.c
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux
Thread model: posix
gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)
/usr/libexec/gcc/i386-redhat-linux/4.0.1/cc1plus -E -quiet -v -D_GNU_SOURCE
test.c -Wswitch-default -Wall -pedantic -fpch-preprocess -o test.ii
ignoring nonexistent directory
"/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/i386-redhat-linux
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/backward
/usr/local/include
/usr/lib/gcc/i386-redhat-linux/4.0.1/include
/usr/include
End of search list.
/usr/libexec/gcc/i386-redhat-linux/4.0.1/cc1plus -fpreprocessed test.ii -quiet
-dumpbase test.c -auxbase test -Wswitch-default -Wall -pedantic -version -o test.s
GNU C++ version 4.0.1 20050727 (Red Hat 4.0.1-5) (i386-redhat-linux)
compiled by GNU C version 4.0.1 20050727 (Red Hat 4.0.1-5).
GGC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=96921
test.c: In function 'void foo(ArrayType*)':
test.c:12: warning: switch missing default case
as -V -Qy -o test.o test.s
GNU assembler version 2.15.94.0.2.2 (i386-redhat-linux) using BFD version
2.15.94.0.2.2 20041220
/usr/libexec/gcc/i386-redhat-linux/4.0.1/collect2 --eh-frame-hdr -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 -o test
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../crt1.o
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../crti.o
/usr/lib/gcc/i386-redhat-linux/4.0.1/crtbegin.o
-L/usr/lib/gcc/i386-redhat-linux/4.0.1 -L/usr/lib/gcc/i386-redhat-linux/4.0.1
-L/usr/lib/gcc/i386-redhat-linux/4.0.1/../../.. test.o -lstdc++ -lm -lgcc_s
-lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/i386-redhat-linux/4.0.1/crtend.o
/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../crtn.o
Testcase code:
#include <iostream>
using namespace std;
template <typename ArrayType>
void foo( ArrayType * arr )
{
int i = 0;
for ( ;; )
{
switch ( arr[i] )
{
default:
cout << arr[i] << endl;
break;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
cout << "woot" << endl;
continue;
}
i++;
}
}
int main()
{
int arr[10] = {1,2,3,4,5,6,7,8,9,10};
foo<int>(arr);
return 0;
}
--
Summary: -Wswitch-default reports missing default in a template
that has one
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rlibiez at arthmoor dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: Unknown
GCC host triplet: Unknown
GCC target triplet: Unknown
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23959
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/23959] -Wswitch-default reports missing default in a template that has one
2005-09-19 2:34 [Bug c++/23959] New: -Wswitch-default reports missing default in a template that has one rlibiez at arthmoor dot com
@ 2005-09-19 2:35 ` rlibiez at arthmoor dot com
2005-09-19 2:41 ` [Bug c++/23959] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rlibiez at arthmoor dot com @ 2005-09-19 2:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rlibiez at arthmoor dot com 2005-09-19 02:35 -------
Created an attachment (id=9772)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9772&action=view)
Preprocessed compiler output
The preprocessed output from the -save-temps option.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23959
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/23959] [4.0/4.1 Regression] -Wswitch-default reports missing default in a template that has one
2005-09-19 2:34 [Bug c++/23959] New: -Wswitch-default reports missing default in a template that has one rlibiez at arthmoor dot com
2005-09-19 2:35 ` [Bug c++/23959] " rlibiez at arthmoor dot com
@ 2005-09-19 2:41 ` pinskia at gcc dot gnu dot org
2005-09-19 17:57 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-19 2:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-19 02:41 -------
Confirmed, reduced testcase:
template <typename ArrayType>
void foo( )
{
int i = 0;
switch ( i )
{
case 9:
default:
break;
}
}
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
GCC build triplet|Unknown |
GCC host triplet|Unknown |
GCC target triplet|Unknown |
Keywords| |diagnostic
Known to fail| |4.0.0 4.1.0
Known to work| |3.4.0
Last reconfirmed|0000-00-00 00:00:00 |2005-09-19 02:41:50
date| |
Summary|-Wswitch-default reports |[4.0/4.1 Regression] -
|missing default in a |Wswitch-default reports
|template that has one |missing default in a
| |template that has one
Target Milestone|--- |4.0.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23959
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/23959] [4.0/4.1 Regression] -Wswitch-default reports missing default in a template that has one
2005-09-19 2:34 [Bug c++/23959] New: -Wswitch-default reports missing default in a template that has one rlibiez at arthmoor dot com
2005-09-19 2:35 ` [Bug c++/23959] " rlibiez at arthmoor dot com
2005-09-19 2:41 ` [Bug c++/23959] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-09-19 17:57 ` pinskia at gcc dot gnu dot org
2005-09-19 17:59 ` pinskia at gcc dot gnu dot org
2005-09-27 16:11 ` mmitchel at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-19 17:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-19 17:57 -------
: Search converges between 2004-05-11-trunk (#454) and 2004-05-14-trunk (#455).
: Search converges between 2003-10-30-ssa (#120) and 2003-10-31-ssa (#121).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23959
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/23959] [4.0/4.1 Regression] -Wswitch-default reports missing default in a template that has one
2005-09-19 2:34 [Bug c++/23959] New: -Wswitch-default reports missing default in a template that has one rlibiez at arthmoor dot com
` (2 preceding siblings ...)
2005-09-19 17:57 ` pinskia at gcc dot gnu dot org
@ 2005-09-19 17:59 ` pinskia at gcc dot gnu dot org
2005-09-27 16:11 ` mmitchel at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-19 17:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-19 17:58 -------
Obviously caused by:
2003-10-30 Richard Henderson <rth@redhat.com>
* decl.c (pop_switch): Call c_do_switch_warnings.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |rth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23959
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/23959] [4.0/4.1 Regression] -Wswitch-default reports missing default in a template that has one
2005-09-19 2:34 [Bug c++/23959] New: -Wswitch-default reports missing default in a template that has one rlibiez at arthmoor dot com
` (3 preceding siblings ...)
2005-09-19 17:59 ` pinskia at gcc dot gnu dot org
@ 2005-09-27 16:11 ` mmitchel at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:11 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.0.2 |4.0.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23959
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-09-27 16:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-19 2:34 [Bug c++/23959] New: -Wswitch-default reports missing default in a template that has one rlibiez at arthmoor dot com
2005-09-19 2:35 ` [Bug c++/23959] " rlibiez at arthmoor dot com
2005-09-19 2:41 ` [Bug c++/23959] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-09-19 17:57 ` pinskia at gcc dot gnu dot org
2005-09-19 17:59 ` pinskia at gcc dot gnu dot org
2005-09-27 16:11 ` mmitchel 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).