http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic --- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-04-07 09:41:55 UTC --- (In reply to comment #7) > The example > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483#c2 > > shows a compiler bug. No it doesn't. > TYPE VARIABLE [ARGUMENT-TO-CONSTRUCT] > > The compiler must doing like this: > 1. Compile ARGUMENT-TO-CONSTRUCT > 2. Checking of TYPE > 3. VARIABLE declaration No, the variable is in scope after its identifier, so it can be used in the initializer expression, e.g. int i = sizeof(i); // ok int i = i+1; // not ok > The BIG mistake is declaration of VARIABLE from wrong position. No, C++ does not work the way you think it does. It's not a bug. It would be nice to get a warning, but it's not easy to do that.