[Bug c++/82316] New: unexpected warning for using 'register' storage class in extern "C" declarations
development at jordi dot vilar.cat
gcc-bugzilla@gcc.gnu.org
Sun Sep 24 18:17:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82316
Bug ID: 82316
Summary: unexpected warning for using 'register' storage class
in extern "C" declarations
Product: gcc
Version: 7.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: development at jordi dot vilar.cat
Target Milestone: ---
C++ 17 removed the 'register' storage class, but it is still valid in C code.
In g++, a new warning has been included to cope with it:
warning: ISO C++1z does not allow 'register' storage class specifier
[-Wregister]
This warning is issued when compiling in C++ but not when compiling in C, as
expected.
But when including header files for C libraries from C++ code, typically C
declarations are introduced as extern "C". In this case, the warning should
also be supressed, as the 'register' storage refers to a valid C declaration,
but not a C++ declaration.
HOW TO REPRODUCE:
simply, compile the following line with -std=c++17:
extern "C" void test(register int);
More information about the Gcc-bugs
mailing list