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
This commit is contained in:
Marek Polacek 2018-02-26 18:41:56 +00:00 committed by Marek Polacek
parent 40b864f141
commit b671df813a
4 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2018-02-26 Marek Polacek <polacek@redhat.com>
PR c++/84325
* tree.c (replace_placeholders_r): Only check TREE_CONSTANT on
non-types.
2018-02-26 Jason Merrill <jason@redhat.com>
PR c++/84447 - ICE with deleted inherited ctor with default arg.

View File

@ -3091,7 +3091,7 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
replace_placeholders_t *d = static_cast<replace_placeholders_t*>(data_);
tree obj = d->obj;
if (TREE_CONSTANT (*t))
if (TYPE_P (*t) || TREE_CONSTANT (*t))
{
*walk_subtrees = false;
return NULL_TREE;

View File

@ -1,3 +1,8 @@
2018-02-26 Marek Polacek <polacek@redhat.com>
PR c++/84325
* g++.dg/cpp1z/pr84325.C: New test.
2018-02-26 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/builtins-3.c: Move vec_neg builtin tests to

View File

@ -0,0 +1,17 @@
// PR c++/84325
// { dg-do compile }
// { dg-options "-std=c++17" }
struct seconds { int i_{0}; constexpr seconds (int) {} };
template <char... _Digits> constexpr seconds operator""_s() {
return seconds(0);
}
constexpr seconds operator""_s(long double i) {
return seconds(0);
}
template<class TYPE>
struct Param {
constexpr static inline seconds time_to_wait{10_s};
};
struct Empty {};
Param<Empty> p;