public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vopl at bk dot ru" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/100825] function signature constraints are not a part of mangled name
Date: Tue, 01 Jun 2021 13:41:44 +0000	[thread overview]
Message-ID: <bug-100825-4-B8Nyed9TSM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100825-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from vopl at bk dot ru ---
(In reply to Jonathan Wakely from comment #5)
> Yes, I realise that, but I think that is the same rule that means you can't
> change the result of overload resolution for a given call, 

But I have a precedent:

void foo(char) {}
void useFirst()
{
    foo(0); // "void foo(char)" used, no "void foo(int)" visible at now
}

void foo(int) {} // introduce second function
void useSecond()
{
    foo(0); // "void foo(int)" selected as more suitable
}



> which is why the
> second definition gets emitted using the same symbol name as the first.

[defns.signature.templ] states that trailing require-clause is a part of
function signature, so these are two different functions:
template <class T> void foo() {}
template <class T> void foo() requires true {}

Since the signature is the basis for name mangling - different names are
expected for different functions..



> If the constrained overload is declared before the first call to foo<int>()
> then there is no error.

Aha, in such situation there is an only call, no second one, so, no second
symbol and no conflicts.



Thanks.

  parent reply	other threads:[~2021-06-01 13:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-29 11:54 [Bug c++/100825] New: " vopl at bk dot ru
2021-05-29 12:22 ` [Bug c++/100825] " vopl at bk dot ru
2021-05-31 11:08 ` vopl at bk dot ru
2021-06-01  9:47 ` redi at gcc dot gnu.org
2021-06-01 10:44 ` vopl at bk dot ru
2021-06-01 11:30 ` redi at gcc dot gnu.org
2021-06-01 13:41 ` vopl at bk dot ru [this message]
2021-06-02 16:26 ` rs2740 at gmail dot com
2021-06-09 16:56 ` nickolay.merkin at gmail dot com
2021-06-09 17:25 ` redi at gcc dot gnu.org
2021-08-02  9:02 ` redi at gcc dot gnu.org
2021-08-02  9:29 ` redi at gcc dot gnu.org
2022-05-04 20:39 ` redi at gcc dot gnu.org
2023-01-06  6:35 ` pinskia at gcc dot gnu.org
2023-04-07 19:50 ` richard-gccbugzilla at metafoo dot co.uk
2023-10-06  2:02 ` jason at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100825-4-B8Nyed9TSM@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).