explicit not working with template

Chris Heath cheath@math.lsa.umich.edu
Wed May 19 16:39:00 GMT 1999


As far as I know, the following shouldn't compile, because the explicit
keyword should prevent the int being converted into type A.  The explicit
keyword seems only to work when the constructor is not a template.

Here's the (minimal) code:
----------------------------
struct A {
	template<typename T> explicit A(T t) {}
};

void f(A a) {}

int main() {f(1);}
-----------------------------

Here's the version I'm using (it's a mid-March snapshot)
gcc version egcs-2.93.12 19990314 (gcc2 ss-980929 experimental)

Chris Heath



More information about the Gcc-bugs mailing list