g++ does not honour "explicit" keyword in all cases?
Richard Guenther
rguenth@tat.physik.uni-tuebingen.de
Wed Oct 29 15:25:00 GMT 2003
Hi!
Shouldnt g++ reject the following code, following 12.3.2?
struct Foo {
template <class T>
explicit Foo(const T&) {}
};
template <class T>
struct Bar {
static T bar() { return 1; }
};
void foo(void)
{
Bar<double>::bar();
}
here Foo::Foo(const T&) is implicitly called from Bar::bar() returning
int. Both gcc 3.3 and gcc 3.4 (and also intel icpc) accept these. But they
should reject this for the same reason they reject
void foo(void)
{
Foo i = 1.0;
}
?
Thanks for clarification,
Richard.
--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
More information about the Gcc
mailing list