summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-05-07 21:10:42 -0400
committerMarek Polacek <polacek@redhat.com>2020-05-18 18:07:18 -0400
commit5d2246a32c638e9caea109e5dd9f182f5cd43b2a (patch)
treea04197831e09ef6c5a636e2ff3c92ceb9c892bb3 /gcc/cp
parent7a41fcde6c67faafab8c8ee2a31140999383dcef (diff)
c++: Sorry about type-dependent arg for __builtin_has_attribute [PR90915]
Until 92104 is fixed, let's sorry rather than crash. PR c++/90915 * parser.c (cp_parser_has_attribute_expression): Sorry on a type-dependent argument. * g++.dg/ext/builtin-has-attribute.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c7
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 52422cef10f..d8ad1d63bd4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
2020-05-18 Marek Polacek <polacek@redhat.com>
+ PR c++/90915
+ * parser.c (cp_parser_has_attribute_expression): Sorry on a
+ type-dependent argument.
+
+2020-05-18 Marek Polacek <polacek@redhat.com>
+
DR 1512
PR c++/87699
* call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 41712bfdc2c..e944841f5a3 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -8679,7 +8679,12 @@ cp_parser_has_attribute_expression (cp_parser *parser)
location_t atloc = cp_lexer_peek_token (parser->lexer)->location;
if (tree attr = cp_parser_gnu_attribute_list (parser, /*exactly_one=*/true))
{
- if (oper != error_mark_node)
+ if (oper == error_mark_node)
+ /* Nothing. */;
+ else if (type_dependent_expression_p (oper))
+ sorry_at (atloc, "%<__builtin_has_attribute%> with dependent argument "
+ "not supported yet");
+ else
{
/* Fold constant expressions used in attributes first. */
cp_check_const_attributes (attr);