This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/11977] New: illegal "no matching function for call to Base::Base(const Derived<int>&)" compile error


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11977

           Summary: illegal "no matching function for call to
                    Base::Base(const Derived<int>&)" compile error
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vassili_bourdo at softhome dot net
                CC: gcc-bugs at gcc dot gnu dot org

GCC 3.2.3 and 3.3.1 fails to compile (I think legal) code.
At least Microsoft Visual C++ 13.10.3077 (the latest one) 
and Comeau C++ (online compiler) compile it without problem.

-----code start-----
class Base {
public:
	Base()
		{
		}
	Base(Base&)//no 'const' here
		{
		}
};

template<class X>
class Derived:Base {
public:
	Derived(X)
		{
		}
	Derived(Derived& rhs)
		:Base(rhs)
		{
		}
	Derived(const Derived& rhs)
		:Base(rhs)
		{
		}
};

int main()
{
	Derived<int> d1 = 1;//compile error here
	Derived<int> d2(1);//compiles well
}
-----code end-----

----gcc -v output: start-----
Reading specs from d:/TOOLS/GCC/lib/gcc-lib/mingw32/3.3.1/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --
host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --
enable-languages=c,c++,f77,objc,ada,java --disable-win32-registry --disable-
shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x -
-enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-
synchronization
Thread model: win32
gcc version 3.3.1 (mingw special 20030804-1)
 d:\TOOLS\GCC\lib\gcc-lib\mingw32\3.3.1\cc1plus.exe -quiet -v -iprefix 
d:\TOOLS/GCC/lib/gcc-lib/mingw32/3.3.1/ -D__GNUC__=3 -D__GNUC_MINOR__=3 -
D__GNUC_PATCHLEVEL__=1 bug.cxx -D__GNUG__=3 -quiet -dumpbase bug.cxx -auxbase 
bug -version -fmessage-length=0 -o C:\Temp/cc21aaaa.s
GNU C++ version 3.3.1 (mingw special 20030804-1) (mingw32)
	compiled by GNU C version 3.3.1 20030803 (prerelease).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=65446
ignoring nonexistent directory "d:/TOOLS/GCC/mingw32/include"
ignoring nonexistent directory "/mingw/include/c++/3.3.1"
ignoring nonexistent directory "/mingw/include/c++/3.3.1/mingw32"
ignoring nonexistent directory "/mingw/include/c++/3.3.1/backward"
ignoring nonexistent directory "/mingw/include"
ignoring nonexistent directory "/mingw/include"
ignoring nonexistent directory "/mingw/lib/gcc-lib/mingw32/3.3.1/include"
ignoring nonexistent directory "/mingw/mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 d:/TOOLS/GCC/include
 c:/temp/dumpster/@libs/boost
 d:/TOOLS/GCC/include/c++/3.3.1
 d:/TOOLS/GCC/include/c++/3.3.1/mingw32
 d:/TOOLS/GCC/include/c++/3.3.1/backward
 d:/TOOLS/GCC/include
 d:/TOOLS/GCC/lib/gcc-lib/mingw32/3.3.1/include
End of search list.
bug.cxx: In copy constructor `Derived<X>::Derived(const Derived<X>&) [with X = 
int]':
bug.cxx:29:   instantiated from here
bug.cxx:23: error: no matching function for call to `Base::Base(const 
Derived<int>&)'
bug.cxx:7: error: candidates are: Base::Base(Base&)
bug.cxx:4: error:                 Base::Base()
bug.cxx: In function `int main()':
bug.cxx:29: error:   initializing temporary from result of `Derived<X>::Derived
(X) [with X = int]'
----gcc -v output: end-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]