From: Marek Polacek Date: Wed, 14 Mar 2018 06:14:57 +0000 (+0000) Subject: re PR c++/84596 (internal compiler error: unexpected expression '(bool)c' of kind... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8fef0dc6a9479bdd4f82e52f7b7e1e678a817b75;p=gcc.git re PR c++/84596 (internal compiler error: unexpected expression '(bool)c' of kind implicit_conv_expr (cxx_eval_constant_expression)) PR c++/84596 * semantics.c (finish_static_assert): Check instantiation_dependent_expression_p instead of {type,value}_dependent_expression_p. * g++.dg/cpp0x/static_assert15.C: New test. From-SVN: r258513 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 71fba751807..067d53835b6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2018-03-14 Marek Polacek + + PR c++/84596 + * semantics.c (finish_static_assert): Check + instantiation_dependent_expression_p instead of + {type,value}_dependent_expression_p. + 2018-03-13 Paolo Carlini Jason Merrill diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index bb8b5953539..fdf37bea770 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -8630,8 +8630,7 @@ finish_static_assert (tree condition, tree message, location_t location, if (check_for_bare_parameter_packs (condition)) condition = error_mark_node; - if (type_dependent_expression_p (condition) - || value_dependent_expression_p (condition)) + if (instantiation_dependent_expression_p (condition)) { /* We're in a template; build a STATIC_ASSERT and put it in the right place. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bc31ea6a114..a4bf53c8bc4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-14 Marek Polacek + + PR c++/84596 + * g++.dg/cpp0x/static_assert15.C: New test. + 2018-03-13 Steven G. Kargl PR fortran/61775 diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert15.C b/gcc/testsuite/g++.dg/cpp0x/static_assert15.C new file mode 100644 index 00000000000..a740f73fd4a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert15.C @@ -0,0 +1,10 @@ +// PR c++/84596 +// { dg-do compile { target c++11 } } + +template +struct a { + constexpr void b() { + int c; + static_assert(c %= 1, ""); + } +};