https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115546
Bug ID: 115546 Summary: [14.1.0 Regression] Section Type Conflict Error Product: gcc Version: 14.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nikhilg1 at uci dot edu Target Milestone: --- Consider the following reduced test case: $>cat test.cpp template <class T> int v2 __attribute__((section("A"))) = sizeof(T); template <> int v2<double> __attribute__((section("A"))) = 50; void a(int*& x) { x = &v2<int>; } $>g++-13 -c test.cpp && echo OK OK $>g++-14 -c test.cpp && echo OK test.cpp:2:5: error: 'v2<int>' causes a section type conflict with 'v2<double>' 2 | int v2 __attribute__((section("A"))) = sizeof(T); | ^~ test.cpp:5:5: note: 'v2<double>' was declared here 5 | int v2<double> __attribute__((section("A"))) = 50; | ^~~~~~~~~~ $>clang++-17 -c test.cpp && echo OK OK I am looking through the docs on the section attribute (https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/Common-Variable-Attributes.html) but am not able to see any reason why this case has started to fail. I also don't see any other compiler failing for this case. Issue is occurring since g++ 14.1.0 and seems to be reproducible on trunk as well.