Ada profiles cannot overload methods solely by the C++ cv/ref qualification of
their implicit object parameter, and the mapper also gives copy and move
assignment the same synthetic name.
For example:
struct Accessor {
int inspect();
int inspect() const;
int inspect() volatile;
int category() &;
int category() &&;
};
struct Value {
Value&operator=(const Value&);
Value&operator=(Value&&);
};
The unpatched mapper emits colliding Ada declarations:
function inspect (this : access Accessor) return int;
function inspect (this : accessconstant Accessor) return int;
function inspect (this : access Accessor) return int;
function category (this : access Accessor) return int;
function category (this : access Accessor) return int;
function Assign_Value (...) returnaccess Value;
function Assign_Value (...) returnaccess Value;
The corrected output preserves the otherwise-lost C++ identity in stable Ada
suffixes:
function inspect (this : access Accessor) return int;
function inspect_Const (this : accessconstant Accessor) return int;
function inspect_Volatile (this : access Accessor) return int;
function category_Lvalue (this : access Accessor) return int;
function category_Rvalue (this : access Accessor) return int;
function Assign_Value (...) returnaccess Value;
function Assign_Value_Move (...) returnaccess Value;
Const, volatile, lvalue-ref, and rvalue-ref suffixes are combined in that
order. The names expose distinctions that Ada cannot encode in the profiles;
callers remain responsible for satisfying the C++ object-category semantics.
The executable regression calls every corrected binding and checks copy/move
assignment effects at -O0 and -O2.
Patch.
Variant gcc-13-14
Applies to 13.2.0, 14.2.0. Source flavors: linux, darwin_arm64.
GNAT rejects duplicate method or assignment declarations because C++ qualifier identity is absent from the Ada names.
After the patch
Stable qualifier suffixes produce compilable Ada and call the correct cv/ref-qualified methods and copy/move assignment symbols at -O0 and -O2.
Upstream issue
Not yet filed.
Upstream submission
Not yet filed or submitted upstream.
Provenance
Repository-authored GCC patch and executable regression; exact application verified locally against the pinned Darwin release identities. Pinned FSF release application is required by Linux CI.
Licensing
GCC-derived compiler hunks remain GPL-3.0-or-later. The new test is proposed for the GCC testsuite under GCC project terms.