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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
At the very least, GCC should give better errors instead of just letting the
assembler complain. Clang tells you where the conflicting definitions come
from, e.g. for the code in comment 1:

1.C:7:23: error: definition with same mangled name '_Z3fooIiEvv' as another
definition
template <class> void foo() requires true {} //2
                      ^
1.C:1:23: note: previous definition is here
template <class> void foo() {} //1
                      ^
1 error generated.


Similarly with EDG:

eccp: diagnostics generated from compilation of 1.int.c:
1.C:7:65: error: redefinition of ‘_Z3fooIiEvv’
    7 | template <class> void foo() requires true {} //2
      |                                                                 ^       
1.C:1:65: note: previous definition of ‘_Z3fooIiEvv’ with type ‘void(void)’
    1 | template <class> void foo() {} //1
      |                                                                 ^       
eccp: end of diagnostics from compilation of 1.int.c
eccp: gcc compilation of 1.int.c returned an exit status of 1


These are both much better than the result with GCC:

/tmp/ccnRtmjt.s: Assembler messages:
/tmp/ccnRtmjt.s:59: Error: symbol `_Z3fooIiEvv' is already defined

Reply via email to