From 4bcbb7b81656dd029be329bd0b6545fe71405269 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Sun, 21 May 2017 22:20:05 +0000 Subject: [PATCH] re PR c++/70265 (ICE on code with constexpr on x86_64-linux-gnu in tree check: expected statement_list, have nop_expr in tsi_start, at tree-iterator.h:42) 2017-05-21 Paolo Carlini PR c++/70265 * g++.dg/cpp1y/constexpr-70265-1.C: New. * g++.dg/cpp1y/constexpr-70265-2.C: Likewise. From-SVN: r248313 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp1y/constexpr-70265-1.C | 13 +++++++++++++ gcc/testsuite/g++.dg/cpp1y/constexpr-70265-2.C | 13 +++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-70265-1.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-70265-2.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fb4b1bd2db0..0ae3270e1c0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-05-21 Paolo Carlini + + PR c++/70265 + * g++.dg/cpp1y/constexpr-70265-1.C: New. + * g++.dg/cpp1y/constexpr-70265-2.C: Likewise. + 2017-05-19 Jerry DeLisle PR libgfortran/80333 diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-1.C new file mode 100644 index 00000000000..e0fcdfeb693 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-1.C @@ -0,0 +1,13 @@ +// PR c++/70265 +// { dg-do compile { target c++14 } } + +constexpr int +foo (int p) +{ + int t = 0; + while (1) // { dg-error "count exceeds" } + ; + return t; +} + +static_assert (foo (1) == 0, ""); // { dg-error "non-constant" } diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-2.C new file mode 100644 index 00000000000..fc360f1a9bb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-2.C @@ -0,0 +1,13 @@ +// PR c++/70265 +// { dg-do compile { target c++14 } } + +constexpr int +foo (int p) +{ + int t = 0; + while (1) + t = 0; // { dg-error "count exceeds" } + return t; +} + +static_assert (foo (1) == 0, ""); // { dg-error "non-constant" } -- 2.30.2