From: Marek Polacek Date: Mon, 26 Feb 2018 18:41:56 +0000 (+0000) Subject: re PR c++/84325 (internal compiler error, in cxx_eval_constant_expression gcc/cp... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b671df813a16a75345cceb35030333ccc36c39f9;p=gcc.git re PR c++/84325 (internal compiler error, in cxx_eval_constant_expression gcc/cp/constexpr.c:4740) PR c++/84325 * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on non-types. * g++.dg/cpp1z/pr84325.C: New test. From-SVN: r258008 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 59d4ceead67..7499992a73a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-02-26 Marek Polacek + + PR c++/84325 + * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on + non-types. + 2018-02-26 Jason Merrill PR c++/84447 - ICE with deleted inherited ctor with default arg. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 39c1ef28b2d..41d9002d8f9 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -3091,7 +3091,7 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_) replace_placeholders_t *d = static_cast(data_); tree obj = d->obj; - if (TREE_CONSTANT (*t)) + if (TYPE_P (*t) || TREE_CONSTANT (*t)) { *walk_subtrees = false; return NULL_TREE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ba25b2e19e4..6fd236cd1af 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-26 Marek Polacek + + PR c++/84325 + * g++.dg/cpp1z/pr84325.C: New test. + 2018-02-26 Carl Love * gcc.target/powerpc/builtins-3.c: Move vec_neg builtin tests to diff --git a/gcc/testsuite/g++.dg/cpp1z/pr84325.C b/gcc/testsuite/g++.dg/cpp1z/pr84325.C new file mode 100644 index 00000000000..dddadc32692 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/pr84325.C @@ -0,0 +1,17 @@ +// PR c++/84325 +// { dg-do compile } +// { dg-options "-std=c++17" } + +struct seconds { int i_{0}; constexpr seconds (int) {} }; +template constexpr seconds operator""_s() { + return seconds(0); +} +constexpr seconds operator""_s(long double i) { + return seconds(0); +} +template +struct Param { + constexpr static inline seconds time_to_wait{10_s}; +}; +struct Empty {}; +Param p;