Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/gcc.dg/cond-constqual-1.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/gcc.dg/cond-constqual-1.c Fri Oct 27 22:46:09 2017 +0900 @@ -0,0 +1,15 @@ +/* Test for const qualification of type of conditional expression. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int foo (int) __attribute__ ((const)); +const int i; + +void +test (void) +{ + __typeof__ (1 ? foo (0) : 0) texpr; + __typeof__ (1 ? i : 0) texpr2; + texpr = 0; /* { dg-bogus "read-only variable" "conditional expression with call to const function" } */ + texpr2 = 0; /* { dg-error "read-only variable" "conditional expression with const variable" } */ +}