diff gcc/testsuite/g++.dg/warn/miss-format-7.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/g++.dg/warn/miss-format-7.C	Thu Feb 13 11:34:05 2020 +0900
@@ -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