libio bugs

Mark Mitchell mmitchell@usa.net
Mon Feb 2 11:43:00 GMT 1998


    Andreas> |> Since the order of initializers isn't supposed to
    Andreas> matter, there is |> definitely a bug here if this fix
    Andreas> makes a difference.  Does anyone |> have a simple
    Andreas> test-case for this bug?

    Andreas> G++ simply ignores all initializer labels.  I have
    Andreas> already send a bug report, here it is again:

Ah, I see.  But initializer labels are a g++ extension.  Perhaps it
would be simpler simply to issue an error message on any use of
initializer labels?  Is the point of this to allow out-of-order
initialization of the members?  Why is there code in libio that uses
this extension?  Is there other C++ code that uses this extension?

    Andreas> $ cat init.cc struct X { int a, b; };

    Andreas> struct X f (int a, int b) { struct X y = { b: b, a: a };
    Andreas> // labels ignored by g++ return y; }

    Andreas> int main () { struct X x = f (42, 0); if (x.a != 42 ||
    Andreas> x.b != 0) abort (); exit (0); } $ gcc init.cc $ ./a.out
    Andreas> Aborted (core dumped)

    Andreas> -- Andreas Schwab "And now for something
    Andreas> schwab@issan.informatik.uni-dortmund.de completely
    Andreas> different" schwab@gnu.org


-- 
Mark Mitchell		mmitchell@usa.net
Stanford University	http://www.stanford.edu




More information about the Gcc mailing list