This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/57] [DR 325] GCC can't parse a non-parenthesized comma in a template-id within a default argument
- From: "zerger at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jan 2009 06:03:40 -0000
- Subject: [Bug c++/57] [DR 325] GCC can't parse a non-parenthesized comma in a template-id within a default argument
- References: <bug-57-797@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #40 from zerger at gmail dot com 2009-01-06 06:03 -------
(In reply to comment #38)
> Subject: Re: [DR 325] GCC can't parse a non-parenthesized comma in a
> template-id within a default argument
>
> It is fixed but the defect report against the C++ standard is still
> open so ...
> -- Pinski
>
Hello.
First, I'm new in gcc.
I'm moving our project on gcc and I meet this bug.
My code:
template <typename T, bool F>
struct sp
{
sp ()
{
}
};
struct X
{
typedef sp <X, true> sp_x;
//X (sp_x x = sp_x ()) // OK
//X (sp <X, true> x = (sp <X, true> ())) // OK
X (sp <X, true> x = sp <X, true> ()) // ERROR
{
}
};
My gcc output:
g++ -o /home/zerg/bs/plugins/test.o -c -v -save-temps
/home/zerg/bs/plugins/test.cpp
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-cpu=generic --build=i386-redhat-linux
Thread model: posix
gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)
COLLECT_GCC_OPTIONS='-o' '/home/zerg/bs/plugins/test.o' '-c' '-v' '-save-temps'
'-shared-libgcc' '-mtune=generic'
/usr/libexec/gcc/i386-redhat-linux/4.3.2/cc1plus -E -quiet -v -D_GNU_SOURCE
/home/zerg/bs/plugins/test.cpp -mtune=generic -fpch-preprocess -o test.ii
ignoring nonexistent directory
"/usr/lib/gcc/i386-redhat-linux/4.3.2/include-fixed"
ignoring nonexistent directory
"/usr/lib/gcc/i386-redhat-linux/4.3.2/../../../../i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i386-redhat-linux/4.3.2/../../../../include/c++/4.3.2
/usr/lib/gcc/i386-redhat-linux/4.3.2/../../../../include/c++/4.3.2/i386-redhat-linux
/usr/lib/gcc/i386-redhat-linux/4.3.2/../../../../include/c++/4.3.2/backward
/usr/local/include
/usr/lib/gcc/i386-redhat-linux/4.3.2/include
/usr/include
End of search list.
COLLECT_GCC_OPTIONS='-o' '/home/zerg/bs/plugins/test.o' '-c' '-v' '-save-temps'
'-shared-libgcc' '-mtune=generic'
/usr/libexec/gcc/i386-redhat-linux/4.3.2/cc1plus -fpreprocessed test.ii -quiet
-dumpbase test.cpp -mtune=generic -auxbase-strip /home/zerg/bs/plugins/test.o
-version -o test.s
GNU C++ (GCC) version 4.3.2 20081105 (Red Hat 4.3.2-7) (i386-redhat-linux)
compiled by GNU C version 4.3.2 20081105 (Red Hat 4.3.2-7), GMP version
4.2.2, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: a43cbcaee4cf8f26ffea6bb0c2e68739
/home/zerg/bs/plugins/test.cpp:23: error: expected identifier before 'true'
/home/zerg/bs/plugins/test.cpp:23: error: expected ',' or '...' before 'true'
/home/zerg/bs/plugins/test.cpp:23: error: wrong number of template arguments
(1, should be 2)
/home/zerg/bs/plugins/test.cpp:4: error: provided for 'template<class T, bool
F> struct sp'
/home/zerg/bs/plugins/test.cpp:23: error: default argument missing for
parameter 2 of 'X::X(sp<X, true>, int)'
I read all comments and saw a patch. But I don't know how I can fix my gcc with
this patch.
--
zerger at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |zerger at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57