[Bug c++/92062] [9/10 Regression] ODR-use by static_assert ignored for static member of class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92062 --- Comment #5 from Marek Polacek --- Author: mpolacek Date: Mon Oct 21 18:45:45 2019 New Revision: 277266 URL: https://gcc.gnu.org/viewcvs?rev=277266=gcc=rev Log: PR c++/92062 - ODR-use ignored for static member of class template. has_value_dependent_address wasn't stripping location wrappers so it gave the wrong answer for "" in the static_assert. That led us to thinking that the expression isn't instantiation-dependent, and we skipped static initialization of A<0>::x. This patch adds stripping so that has_value_dependent_address gives the same answer as it used to before the location wrappers addition. * pt.c (has_value_dependent_address): Strip location wrappers. * g++.dg/cpp0x/constexpr-odr1.C: New test. * g++.dg/cpp0x/constexpr-odr2.C: New test. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-odr1.C trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-odr2.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog
[Bug c++/92062] [9/10 Regression] ODR-use by static_assert ignored for static member of class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92062 Marek Polacek changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
[Bug c++/92062] [9/10 Regression] ODR-use by static_assert ignored for static member of class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92062 --- Comment #4 from Marek Polacek --- Candidate fix: --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6542,6 +6542,7 @@ check_valid_ptrmem_cst_expr (tree type, tree expr, static bool has_value_dependent_address (tree op) { + STRIP_ANY_LOCATION_WRAPPER (op); /* We could use get_inner_reference here, but there's no need; this is only relevant for template non-type arguments, which can only be expressed as */
[Bug c++/92062] [9/10 Regression] ODR-use by static_assert ignored for static member of class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92062 --- Comment #3 from Marek Polacek --- Looks like the issue is that the condition of the static_assert (_CONVERT_EXPR(x)) is no longer considered instantiation_dependent_expression_p, because of the location wrapper. Before r267272 the condition was "" and was considered instantiation_dependent_expression_p.
[Bug c++/92062] [9/10 Regression] ODR-use by static_assert ignored for static member of class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92062 Marek Polacek changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2019-10-11 Target Milestone|--- |9.3 Summary|ODR-use by static_assert|[9/10 Regression] ODR-use |ignored for static member |by static_assert ignored |of class template |for static member of class ||template Ever confirmed|0 |1