+2020-05-11 Jason Merrill <jason@redhat.com>
+
+ * decl.c (grokdeclarator): Adjust deprecated_state here.
+ (start_decl): Not here.
+
2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
PR c++/95003
*pushed_scope_p = NULL_TREE;
- /* An object declared as __attribute__((deprecated)) suppresses
- warnings of uses of other deprecated items. */
- if (lookup_attribute ("deprecated", attributes))
- deprecated_state = DEPRECATED_SUPPRESS;
-
attributes = chainon (attributes, prefix_attributes);
decl = grokdeclarator (declarator, declspecs, NORMAL, initialized,
&attributes);
- deprecated_state = DEPRECATED_NORMAL;
-
if (decl == NULL_TREE || VOID_TYPE_P (decl)
|| decl == error_mark_node)
return error_mark_node;
type = NULL_TREE;
type_was_error_mark_node = true;
}
+
+ /* Ignore erroneous attributes. */
+ if (attrlist && *attrlist == error_mark_node)
+ *attrlist = NULL_TREE;
+
+ /* An object declared as __attribute__((deprecated)) suppresses
+ warnings of uses of other deprecated items. */
+ temp_override<deprecated_states> ds (deprecated_state);
+ if (attrlist && lookup_attribute ("deprecated", *attrlist))
+ deprecated_state = DEPRECATED_SUPPRESS;
+
cp_warn_deprecated_use (type);
if (type && TREE_CODE (type) == TYPE_DECL)
{
class T {
public:
void member1(int) __attribute__ ((deprecated("Please avoid member1")));
- void member2(INT1) __attribute__ ((__deprecated__("Please avoid member2"))); /* { dg-warning "'INT1' is deprecated" } */
+ void member2(INT1) __attribute__ ((__deprecated__("Please avoid member2")));
int member3(T *);
int x;
} __attribute__ ((deprecated("Please avoid T")));
class T {
public:
void member1(int) __attribute__ ((deprecated));
- void member2(INT1) __attribute__ ((__deprecated__)); /* { dg-warning "'INT1' is deprecated" } */
+ void member2(INT1) __attribute__ ((__deprecated__));
int member3(T *);
int x;
} __attribute__ ((deprecated));