This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: pair (or template class) in constuctor
- From: Peter Schmid <schmid at snake dot iap dot physik dot tu-darmstadt dot de>
- To: gcc-bugs at gcc dot gnu dot org
- Cc: lfarkas at mindmaker dot hu, pedwards at disaster dot jaj dot com
- Date: Fri, 16 Nov 2001 17:15:25 +0100 (CET)
- Subject: Re: pair (or template class) in constuctor
[Get raw message]
Gcc 3.1 does not accept the first constructor in line 7 in contrast to
gcc 3.0.2.
Hope this helps,
Peter Schmid
source code tpair.C included in Mr Farkas email
#include <utility>
class A
{
std::pair<char*, long> p;
public:
A(std::pair<char*, long> r = std::pair<char*, long>(0, 0L));
A(std::pair<char*, long> r = std::make_pair((char*)(0), 0L));
};
A::A(std::pair<char*, long> r) : p(r) {}
int main()
{
A a;
return 0;
}
g++ -v -W -Wall tpair.C
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../gcc/configure --enable-shared --disable-nls --enable-threads=posix --enable-clocale=gnu --enable-languages=c,c++,f77,objc
Thread model: posix
gcc version 3.1 20011106 (experimental)
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -W -Wall -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ tpair.C -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase tpair.C -W -Wall -version -o /tmp/ccFi43Q2.s
GNU CPP version 3.1 20011106 (experimental) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.1 20011106 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.1 20011106 (experimental).
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/g++-v3
/usr/local/include/g++-v3/i686-pc-linux-gnu
/usr/local/include/g++-v3/backward
/usr/local/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/include
/usr/include
End of search list.
tpair.C:7: parse error before `>' token
tpair.C: In function `int main()':
tpair.C:15: warning: unused variable `A a'