PR c++/90953 - ICE with -Wmissing-format-attribute.
* c-common.c (check_function_arguments_recurse): Use get_attribute_name. (check_missing_format_attribute): Likewise. * g++.dg/warn/miss-format-7.C: New test. From-SVN: r272552
This commit is contained in:
parent
390549c8a1
commit
3f3d6a6fa3
4 changed files with 44 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
2019-06-21 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/90953 - ICE with -Wmissing-format-attribute.
|
||||
* c-common.c (check_function_arguments_recurse): Use
|
||||
get_attribute_name.
|
||||
(check_missing_format_attribute): Likewise.
|
||||
|
||||
2019-06-19 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/60364 - noreturn after first decl not diagnosed.
|
||||
|
|
|
@ -5753,7 +5753,7 @@ check_function_arguments_recurse (void (*callback)
|
|||
for (attrs = TYPE_ATTRIBUTES (type);
|
||||
attrs;
|
||||
attrs = TREE_CHAIN (attrs))
|
||||
if (is_attribute_p ("format_arg", TREE_PURPOSE (attrs)))
|
||||
if (is_attribute_p ("format_arg", get_attribute_name (attrs)))
|
||||
{
|
||||
tree inner_arg;
|
||||
tree format_num_expr;
|
||||
|
@ -7601,13 +7601,13 @@ check_missing_format_attribute (tree ltype, tree rtype)
|
|||
tree ra;
|
||||
|
||||
for (ra = TYPE_ATTRIBUTES (ttr); ra; ra = TREE_CHAIN (ra))
|
||||
if (is_attribute_p ("format", TREE_PURPOSE (ra)))
|
||||
if (is_attribute_p ("format", get_attribute_name (ra)))
|
||||
break;
|
||||
if (ra)
|
||||
{
|
||||
tree la;
|
||||
for (la = TYPE_ATTRIBUTES (ttl); la; la = TREE_CHAIN (la))
|
||||
if (is_attribute_p ("format", TREE_PURPOSE (la)))
|
||||
if (is_attribute_p ("format", get_attribute_name (la)))
|
||||
break;
|
||||
return !la;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2019-06-21 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/90953 - ICE with -Wmissing-format-attribute.
|
||||
* g++.dg/warn/miss-format-7.C: New test.
|
||||
|
||||
2019-06-21 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR debug/90914
|
||||
|
|
29
gcc/testsuite/g++.dg/warn/miss-format-7.C
Normal file
29
gcc/testsuite/g++.dg/warn/miss-format-7.C
Normal file
|
@ -0,0 +1,29 @@
|
|||
// PR c++/90953 - ICE with -Wmissing-format-attribute.
|
||||
// { dg-do compile { target c++11 } }
|
||||
// { dg-options "-Wmissing-format-attribute" }
|
||||
|
||||
namespace std {
|
||||
union [[gnu::may_alias]] _Any_data{};
|
||||
enum _Manager_operation { __get_type_info };
|
||||
template <typename> class A;
|
||||
class B {
|
||||
typedef bool (*_Manager_type)(_Any_data, const _Any_data &,
|
||||
_Manager_operation);
|
||||
public:
|
||||
_Any_data _M_functor;
|
||||
_Manager_type _M_manager;
|
||||
};
|
||||
|
||||
struct type_info { } t;
|
||||
|
||||
template <typename _Res, typename... _ArgTypes>
|
||||
class A<_Res(_ArgTypes...)> : B {
|
||||
const type_info &target_type() const noexcept;
|
||||
};
|
||||
template <typename _Res, typename... _ArgTypes>
|
||||
const type_info &A<_Res(_ArgTypes...)>::target_type() const noexcept {
|
||||
_Any_data __typeinfo_result;
|
||||
_M_manager(__typeinfo_result, _M_functor, __get_type_info);
|
||||
return t;
|
||||
}
|
||||
} // namespace std
|
Loading…
Add table
Reference in a new issue