https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124394
Bug ID: 124394
Summary: [reflection] same extern "C" functions in different
namespaces
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: leni536 at gmail dot com
Target Milestone: ---
version: g++
(Compiler-Explorer-Build-gcc-e0d9c5a23fff9002b6f971ee868bd05d7fa1e6ef-binutils-2.44)
16.0.1 20260306 (experimental)
flags: -std=c++26 -O3 -freflection
Consider:
#include <meta>
extern "C" {
namespace N1 {
void f();
}
namespace N2 {
void f();
}
}
using N1::f;
using N2::f;
static_assert(^^N1::f == ^^N2::f); // error: static assertion failed
https://godbolt.org/z/4qoxoo4de
I expect the static assertion to pass, as the compared reflections represent
the same function.
https://eel.is/c++draft/expr.eq#6.4