warning not issued
Joe Buck
jbuck@synopsys.com
Wed Oct 21 22:10:00 GMT 1998
> The following code does not warn you that the initialization of `t' is
> skipped. The result is a segfault when exiting main.
This is not legal C++; you can't jump around an initializer with a
goto or a switch unless the initializer is inside curly braces.
Just the same, the compiler should have caught it ... I'm sure this
was missed because most folks don't use goto.
> egcs-1.1b on RedHat 5.1.
>
> #include <vector>
>
> int
> main(int argc)
> {
> goto done;
> vector<int> t;
> done:;
> }
More information about the Gcc
mailing list