view gcc/testsuite/gcc.dg/cond-constqual-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* 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" } */
}