[Bug c++/100825] function signature constraints are not a part of mangled name

vopl at bk dot ru gcc-bugzilla@gcc.gnu.org
Tue Jun 1 10:44:18 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100825

--- Comment #4 from vopl at bk dot ru ---
(In reply to Jonathan Wakely from comment #3)
> Clang and EDG agree with GCC here.
> 
> I think your code is ill-formed due to [temp.constr.atomic] p3:
> 
> "If, at different points in the program, the satisfaction result is
> different for identical atomic constraints and template arguments, the
> program is ill-formed, no diagnostic required."

Please, take a look at [temp.constr.atomic] p2: Two atomic constraints, e1 and
e2, are identical if they are formed from the same appearance of the same
expression and...

My code contains two functions (last case, from Comment#1):
template <class T> void foo() /*empty constraints*/;
template <class T> void foo() requires true;

empty constraints from first functions is not identical "requires true" from
second one, so, [temp.constr.atomic] p3 is not applicable here.

------------
Here is a sample with constraints in both functions:

template <class T> concept C1 = sizeof(T) > 1;
template <class T> concept C2 = C1<T> && sizeof(T) < 24;

template <class T> void foo() requires C1<T> {}
void useFirst()
{
    foo<int>();
}

template <class T> void foo() requires C2<T> {}
void useSecond()
{
    foo<int>();
}

/tmp/ccZLqFRh.s:69: Error: symbol `_Z3fooIiEvv' is already defined

Thanks.


More information about the Gcc-bugs mailing list