]> gcc.gnu.org Git - gcc.git/commit
c++: Improve sorry for __builtin_has_attribute [PR98355]
authorMarek Polacek <polacek@redhat.com>
Fri, 29 Jan 2021 16:29:25 +0000 (11:29 -0500)
committerMarek Polacek <polacek@redhat.com>
Mon, 1 Feb 2021 15:09:11 +0000 (10:09 -0500)
commitbab669f2fc643cb1673aecd177eec1c773e9e48e
tree510fff973e5d9d15d39ea43a78c6e8129700086b
parent6e0a231a4aa2407bb7167daf98a37795a67364d8
c++: Improve sorry for __builtin_has_attribute [PR98355]

__builtin_has_attribute doesn't work in templates yet (bug 92104), so
in r11-471 I added a sorry.  But that only caught type-dependent
expressions and we also want to sorry on value-dependent expressions.
This patch uses uses_template_parms, but guarded with p_t_d, because
u_t_p sets p_t_d and then v_d_e_p considers variables with reference
types value-dependent, which breaks builtin-has-attribute-6.c.

This is a regression and I also plan to apply this to gcc-10.

gcc/cp/ChangeLog:

PR c++/98355
* parser.c (cp_parser_has_attribute_expression): Use
uses_template_parms instead of type_dependent_expression_p.

gcc/testsuite/ChangeLog:

PR c++/98355
* g++.dg/ext/builtin-has-attribute2.C: New test.
gcc/cp/parser.c
gcc/testsuite/g++.dg/ext/builtin-has-attribute2.C [new file with mode: 0644]
This page took 0.058834 seconds and 6 git commands to generate.