aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2019-10-21 18:45:45 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2019-10-21 18:45:45 +0000
commitafa8c090bf5ee17d89628b4885efad3a7ea62505 (patch)
tree65f87ce073121c8d4bd994dcf4e5e74123b412fd /gcc/cp
parente011c0100a83030e0cfd230658debbb6c97660a1 (diff)
downloadgcc-afa8c090bf5ee17d89628b4885efad3a7ea62505.zip
gcc-afa8c090bf5ee17d89628b4885efad3a7ea62505.tar.gz
gcc-afa8c090bf5ee17d89628b4885efad3a7ea62505.tar.bz2
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 "&x" 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. From-SVN: r277266
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 29c6bbd..f861fb3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2019-10-21 Marek Polacek <polacek@redhat.com>
+ PR c++/92062 - ODR-use ignored for static member of class template.
+ * pt.c (has_value_dependent_address): Strip location wrappers.
+
+2019-10-21 Marek Polacek <polacek@redhat.com>
+
PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
* typeck.c (maybe_warn_about_returning_address_of_local): Avoid
recursing on null initializer and return false instead.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7f7f992..e154cac 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6542,6 +6542,8 @@ 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 &id-expression. */