[Bug c++/87611] New: Cannot suppress warning with #pragma GCC diagnostic warning "-Wabi=12"

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 15 12:09:00 GMT 2018


            Bug ID: 87611
           Summary: Cannot suppress warning with #pragma GCC diagnostic
                    warning "-Wabi=12"
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

struct empty { };
#pragma GCC diagnostic warning "-Wabi=12"
void f(empty, int) { }

Compiling this with -Wabi=11 warns, even though the pragma should cause
-Wabi=12 to be used, and so not warn:

wabi.cc: In function 'void f(empty, int)':
wabi.cc:3:6: warning: empty class 'empty' parameter passing ABI changes in
-fabi-version=12 (GCC 8) [-Wabi]
3 | void f(empty, int) { }
  |      ^

It's necessary to completely disable -Wabi warnings with

#pragma GCC diagnostic ignored "-Wabi"

By contrast, the following does suppress the warning about the PR c++/51322
mangling change:

#pragma GCC diagnostic warning "-Wabi=6"
template<class T> struct Ident { typedef T type; };
template<template<class...>class E,class...F> struct A{typedef E<F...> type;};
typedef A<Ident,int> B;
void f(B){}

Why doesn't it work for the first case?

More information about the Gcc-bugs mailing list