[Bug c++/27129] [4.1/4.2 Regression] ICE in get_expr_operands

prigault at oricom dot ca gcc-bugzilla@gcc.gnu.org
Wed Apr 12 14:00:00 GMT 2006



------- Comment #2 from prigault at oricom dot ca  2006-04-12 14:00 -------
IMO, the line defining c should trigger an error message because it needs to
use c before creating the variable, or else undefined behaviour occurs.
This message could be:
 error: ‘c’ was not declared in this scope
or:
 error: 'c' is used uninitialized

Consider:

$ more test.cc
#include <stdio.h>

static const float f = 1 - a;

int main(void)
{
    printf("%f\n", f);

    return 0;
}

$ g++ -Wall  -O2 -o test  test.cc
test.cc:3: error: ‘a’ was not declared in this scope

$ more test1.cc
#include <stdio.h>

static const float f = 1 - f;

int main(void)
{
    printf("%f\n", f);

    return 0;
}

$ g++ -Wall  -O2 -o test1  test1.cc
$

There should be an error message there as well.


-- 

prigault at oricom dot ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |prigault at oricom dot ca


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27129



More information about the Gcc-bugs mailing list