diff options
author | Marek Polacek <polacek@redhat.com> | 2023-02-23 17:54:47 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2023-02-28 10:08:40 -0500 |
commit | ea718febab2a1f6e58806738abf70f1c73c6a308 (patch) | |
tree | 046173fb8e5d95565ea91771ca1b955fbe146c8a /gcc/tree-vect-patterns.cc | |
parent | c7728805a7107444683290cd629d13f089130a0d (diff) | |
download | gcc-ea718febab2a1f6e58806738abf70f1c73c6a308.zip gcc-ea718febab2a1f6e58806738abf70f1c73c6a308.tar.gz gcc-ea718febab2a1f6e58806738abf70f1c73c6a308.tar.bz2 |
c++: ICE with constexpr variable template [PR107938]
Since r11-557, cp_finish_decl can call check_initializer even in
a template for a constexpr initializer. That ultimately leads to
convert_for_assignment and check_address_or_pointer_of_packed_member,
where we crash, because it doesn't expect that the CALL_EXPR is
a function object. Q has a constexpr operator(), but since we're
in a template, q(0) is a CALL_EXPR whose CALL_EXPR_FN is just
a VAR_DECL; it hasn't been converted to Q::operator<int>(&q, 0) yet.
I propose to robustify check_address_or_pointer_of_packed_member.
var-templ74.C has an XFAIL, subject to 107939.
I noticed that our -Waddress-of-packed-member tests weren't testing
member functions, added thus. (I was tempted to check
FUNCTION_POINTER_TYPE_P but that doesn't include METHOD_TYPE.)
PR c++/107938
gcc/c-family/ChangeLog:
* c-warn.cc (check_address_or_pointer_of_packed_member): Check
POINTER_TYPE_P.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1y/var-templ73.C: New test.
* g++.dg/cpp1y/var-templ74.C: New test.
* g++.dg/warn/Waddress-of-packed-member3.C: New test.
Diffstat (limited to 'gcc/tree-vect-patterns.cc')
0 files changed, 0 insertions, 0 deletions