explicit not working with template

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Thu Feb 24 14:02:00 GMT 2000


> 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.

Thanks for your bug report. The mainline compiler (2.96 20000223
(experimental)) says

a.cc: In function `int main ()':
a.cc:7: conversion from `int' to non-scalar type `A' requested

so it appears the bug has been fixed.

Regards,
Martin


More information about the Gcc-bugs mailing list