public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rlibiez at arthmoor dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/23959] New: -Wswitch-default reports missing default in a template that has one Date: Mon, 19 Sep 2005 02:34:00 -0000 [thread overview] Message-ID: <20050919023421.23959.rlibiez@arthmoor.com> (raw) -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
next reply other threads:[~2005-09-19 2:34 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-09-19 2:34 rlibiez at arthmoor dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20050919023421.23959.rlibiez@arthmoor.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).