https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103862
Bug ID: 103862
Summary: Regression: -Wold-style-cast warns about system macros
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: carlosgalvezp at gmail dot com
Target Milestone: ---
Hi,
I thought this problem was solved by reading this:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12258
But I can still find it on GCC 11.1:
// include/third_party.h
#pragma once
#define MY_CAST(x) ((int)x)
// main.cpp
#include <third_party.h>
int main()
{
int x = MY_CAST(123);
return x;
}
# g++-11 -isystem include -Wold-style-cast main.cpp
In file included from main.cpp:1:
main.cpp: In function 'int main()':
main.cpp:5:21: warning: use of old-style cast to 'int' [-Wold-style-cast]
5 | int x = MY_CAST(123);
| ^~~
# g++-11 --version
g++-11 (Ubuntu 11.1.0-1ubuntu1~20.04) 11.1.0