view gcc/testsuite/g++.dg/cpp0x/constexpr-50060.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line source

// PR c++/50060
// { dg-do compile { target c++11 } }

extern "C" double frexp (double, int *);

struct S
{
  constexpr S (double a) : y {}, x (frexp (a, &y)) {}	// { dg-error "is not a constant expression" "S" { target { ! c++14 } } }
  double x;
  int y;
};

struct T
{
  constexpr T (double a) : y {}, x ((y = 1, 0.8125)) {}	// { dg-error "is not a constant expression" "T" { target { ! c++14 } } }
  double x;
  int y;
};

static_assert (S (6.5).x == 0.8125, "");	// { dg-error "non-constant condition for static assertion|in .constexpr. expansion" "" { target { ! c++14 } } }
static_assert (T (6.5).x == 0.8125, "");	// { dg-error "non-constant condition for static assertion|called in a constant expression" "" { target { ! c++14 } } }