https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64867

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This adds -Wnon-pod-varargs, enabled by -Wconditionally-supported, allowing
e.g.
-Wconditionally-supported -Werror=non-pod-varargs

diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 3435fe90cca..b6ac29cda64 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -714,6 +714,10 @@ Wnamespaces
 C++ ObjC++ Var(warn_namespaces) Warning
 Warn on namespace definition.

+Wnon-pod-varargs
+C++ ObjC++ Var(warn_non_pod_varargs) Warning LangEnabledBy(C++
ObjC++,Wconditionally-supported)
+Warn if passing a non-POD object through the \"...\" of a varargs function.
+
 Wpacked-not-aligned
 C ObjC C++ ObjC++ Var(warn_packed_not_aligned) Warning LangEnabledBy(C ObjC
C++ ObjC++,Wall)
 Warn when fields in a struct with the packed attribute are misaligned.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 9e4a5c1b9ae..fc9f74f5968 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7164,10 +7164,12 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t
complain)
              || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (arg_type)))
        {
          if (complain & tf_warning)
-           warning (OPT_Wconditionally_supported,
-                    "passing objects of non-trivially-copyable "
-                    "type %q#T through %<...%> is conditionally supported",
-                    arg_type);
+           {
+             warning (OPT_Wnon_pod_varargs,
+                      "passing objects of non-trivially-copyable "
+                      "type %q#T through %<...%> is conditionally supported",
+                      arg_type);
+           }
          return cp_build_addr_expr (arg, complain);
        }
     }

Reply via email to