public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "northon_patrick3 at yahoo dot ca" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96848] New: Inherited conditionally explicit constructors via using declaration do not enforce explicitness if dependent on template parameter Date: Sun, 30 Aug 2020 01:03:58 +0000 [thread overview] Message-ID: <bug-96848-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96848 Bug ID: 96848 Summary: Inherited conditionally explicit constructors via using declaration do not enforce explicitness if dependent on template parameter Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: northon_patrick3 at yahoo dot ca Target Milestone: --- Example: https://godbolt.org/z/4x9r7e ```cpp #include <iostream> #include <type_traits> struct E {}; struct F {}; struct G {}; template <typename From_, typename To_> constexpr bool isValidImplicitConvert = false; template <> constexpr bool isValidImplicitConvert<E, G> = true; template <typename T_> struct A { template <typename OT_> explicit(!isValidImplicitConvert<OT_, T_>) constexpr A(const OT_ &) {} //explicit(isValidImplicitConvert<E, T_>) constexpr A(E) {} //explicit(isValidImplicitConvert<F, T_>) constexpr A(F) {} }; template <typename T_> struct B : public A<T_> { using A<T_>::A; }; int main(int, char **) { std::cout << std::is_convertible_v<E, A<G>> << '\n'; std::cout << std::is_convertible_v<F, A<G>> << '\n'; std::cout << std::is_convertible_v<E, B<G>> << '\n'; std::cout << std::is_convertible_v<F, B<G>> << '\n'; return 0; } ``` Output: ``` 1 0 1 1 ``` Expected output: ``` 1 0 1 0 ``` When inheriting constructors from a base class via a using declaration, if said constructors are conditionally explicit and the condition is dependent on a deduced template parameter, the explicit state is ignored. Clang give the expected output, however I am not sure who is correct.
next reply other threads:[~2020-08-30 1:03 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-30 1:03 northon_patrick3 at yahoo dot ca [this message] 2021-08-17 7:06 ` [Bug c++/96848] " pinskia at gcc dot gnu.org 2021-08-17 7:09 ` pinskia at gcc dot gnu.org 2023-02-19 20:12 ` oliver.rosten at googlemail 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-96848-4@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).