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]

g++-2.95.2 explicit constructor


Hi,

Compiling the  code-snippet  below with g++-2.95.2 gives :
"no matching function for call to `B::B (int)'"

Ulf

struct A
{
  explicit A(int);
};

struct B
{
  B(A const &);
};

struct C
{
  C(B const &);
};

void
f()
{
  C c(B(A(1)));
}


> g++ -c -v tmp.cc
Reading specs from
/usr/tmp/ulf/lib/gcc-lib/i386-unknown-freebsdelf/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/tmp/ulf/lib/gcc-lib/i386-unknown-freebsdelf/2.95.2/cpp -lang-c++
-v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Di386
-Dunix -D__ELF__ -D__FreeBSD__ -D__i386__ -D__unix__ -D__ELF__
-D__FreeBSD__ -D__i386 -D__unix -Asystem(unix) -Asystem(FreeBSD)
-Acpu(i386) -Amachine(i386) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386)
-Di386 -D__i386 -D__i386__ tmp.cc /var/tmp/ccYd0ovR.ii
GNU CPP version 2.95.2 19991024 (release) (i386 FreeBSD/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/tmp/ulf/lib/gcc-lib/i386-unknown-freebsdelf/2.95.2/../../../../include/g++-3

 /usr/tmp/ulf/include
 /usr/tmp/ulf/lib/gcc-lib/i386-unknown-freebsdelf/2.95.2/../../../../i386-unknown-freebsdelf/include

 /usr/tmp/ulf/lib/gcc-lib/i386-unknown-freebsdelf/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search
path:
End of omitted list.
 /usr/tmp/ulf/lib/gcc-lib/i386-unknown-freebsdelf/2.95.2/cc1plus
/var/tmp/ccYd0ovR.ii -quiet -dumpbase tmp.cc -version -o
/var/tmp/ccy0U01x.s
GNU C++ version 2.95.2 19991024 (release) (i386-unknown-freebsdelf)
compiled by GNU C version 2.7.2.3.
tmp.cc: In function `void f()':
tmp.cc:19: no matching function for call to `B::B (int)'
tmp.cc:8: candidates are: B::B(const A &)
tmp.cc:9:                 B::B(const B &)



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