public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "m.cencora at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/93740] Template base classes parametrized by pointer-to-member are amibiguous Date: Thu, 03 Dec 2020 10:51:29 +0000 [thread overview] Message-ID: <bug-93740-4-DVtWEMHYgV@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-93740-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93740 --- Comment #3 from m.cencora at gmail dot com --- Still broken in gcc 10.2 and trunk, also in C++20 mode. The problem seems to show up only when address of member function (virtual or not) is passed as template parameter - only then gcc fails during overload resolution. For free functions this works fine. struct A { void foo(); void bar(); }; template <int N, auto val> struct indexed_elem{}; struct A_indexed_member_funcs : indexed_elem<0, &A::foo>, indexed_elem<1, &A::bar> {}; template <auto val, int N> constexpr int index_of(indexed_elem<N, val>) { return N; } void foo(); void bar(); struct indexed_free_funcs : indexed_elem<0, &foo>, indexed_elem<1, &bar> {}; void test() { // this fails due to gcc claim of ambiguous base classes static_assert(index_of<&A::foo>(A_indexed_member_funcs{}) == 0, ""); // this is ok static_assert(index_of<&foo>(indexed_free_funcs{}) == 0, ""); }
next parent reply other threads:[~2020-12-03 10:51 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-93740-4@http.gcc.gnu.org/bugzilla/> 2020-12-03 10:51 ` m.cencora at gmail dot com [this message] 2020-12-03 11:07 ` m.cencora at gmail dot com 2022-01-25 18:23 ` m.cencora at gmail dot com 2023-12-13 20:57 ` cvs-commit at gcc dot gnu.org 2023-12-13 20:58 ` ppalka at gcc dot gnu.org 2024-05-28 12:52 ` 3y3p4tch at protonmail dot com
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-93740-4-DVtWEMHYgV@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: linkBe 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).