12163 – [3.3/3.4 regression] static_cast + explicit ctor regression (original) (raw)

Description Vladimir Prus 2003-09-04 06🔞32 UTC

Using
gcc version 3.3.2 20030831 (Debian prerelease) I get compile error on the following code:

class C { public: explicit C(int) {} };

int main() { int i = 0; static_cast(i); return 0; }

The error is: bash-2.05b$ g++ ex.cpp ex.cpp: In function int main()': ex.cpp:10: error: invalid static_cast from type int' to type `C'

It works in 3.2. It seems that 'static_cast' is rather explcit, so the ctor should be used.

Comment 1 Wolfgang Bangerth 2003-09-04 14:19:36 UTC

I don't have a recent 3.3 snapshot around, but I can confirm that it worked in 3.3.0 and a may snapshot of mainline, while it is broken with present mainline. So it's a regression in any case.

W.

Comment 2 Drea Pinski 2003-09-04 14:38:03 UTC

From Phil's regression hunter: Search converges between 2003-06-25-trunk (#324) and 2003- 06-26-trunk (#325). : Search converges between 2003-06-25-3.3 (#149) and 2003-06-26-3.3 (#150).

Comment 5 Mark Mitchell 2003-09-05 18:36:04 UTC

Fixed in GCC 3.3.2, GCC 3.4.