PR c++/92062 - ODR-use ignored for static member of class template.
authorMarek Polacek <polacek@redhat.com>
Mon, 21 Oct 2019 18:45:45 +0000 (18:45 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 21 Oct 2019 18:45:45 +0000 (18:45 +0000)
commitafa8c090bf5ee17d89628b4885efad3a7ea62505
tree65f87ce073121c8d4bd994dcf4e5e74123b412fd
parente011c0100a83030e0cfd230658debbb6c97660a1
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
gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-odr1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/constexpr-odr2.C [new file with mode: 0644]