https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87178
Bug ID: 87178
Summary: Compilation failure when program contains multiple
variables allocated in particular section, and at
least one variable is C++17 "inline"
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jpmarath at gmail dot com
Target Milestone: ---
This program fails to compile:
//--
inline __attribute__((section("foo"))) int xxx;
__attribute__((section("foo"))) int yyy;
int *p1 = &xxx;
int *p2 = &yyy;
//--
$g++ -std=c++17 -c m1.cpp
<source>:2:37: error: 'yyy' causes a section type conflict with 'xxx'
2 | __attribute__((section("foo"))) int yyy;
| ^~~
<source>:1:44: note: 'xxx' was declared here
1 | inline __attribute__((section("foo"))) int xxx;
| ^~~
The same program compile fine with clang (checked with clang 6.0)