public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "s.murthy at outlook dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/115656] New: Templated ctor use rejected in non-deduced context if class template has template template parameter
Date: Wed, 26 Jun 2024 01:42:39 +0000	[thread overview]
Message-ID: <bug-115656-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 115656
           Summary: Templated ctor use rejected in non-deduced context if
                    class template has template template parameter
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: s.murthy at outlook dot com
  Target Milestone: ---

Using a class constructor in a non-deduced context (when no CTAD is being
attempted, saying that in case my terminology is incorrect) causes an error if
the class template has a template template parameter (lass template A in
repro). Oddly, the error disappears if CTAD is engaged before the erring code.

This is a regression: no issue in GCC 10.5, but issue since GCC 11.1.

Aside, clang accepts this code (from 11.0 to current version)

PS: I searched the bug database and found no report matching this issue, but I
apologize if this issue is known.

Repro below (online https://sigcpp.godbolt.org/z/M1eoE485x):
------------------------------------------------------------

//stub for use in class template A
template<std::unsigned_integral U = unsigned> class dv;

//class template A with template template parameter
template<std::unsigned_integral U = unsigned,
         template <std::unsigned_integral> class V = dv
        >
struct A 
{
    U u_;

    A(U u) : u_(u) {};

    template<std::signed_integral S>
    A(S s) : u_( s < 0 ? -s : s) {}
};


//same as class A but no template template parameter
template<std::unsigned_integral U = unsigned>
struct B 
{
    U u_;

    B(U u) : u_(u) {};

    template<std::signed_integral S>
    B(S s) : u_( s < 0 ? -s : s) {}
};

int main()
{
    //A a1(45ul);
    A a2(45l); //Error CGCC 11.5+: uncomment line above, the error disappears

    B b2(45l); //OK
}

             reply	other threads:[~2024-06-26  1:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26  1:42 s.murthy at outlook dot com [this message]
2024-06-26  1:48 ` [Bug c++/115656] " s.murthy at outlook dot com
2024-06-26  3:57 ` s.murthy at outlook dot com
2024-06-26  4:13 ` s.murthy at outlook dot com
2024-06-26  4:26 ` s.murthy at outlook dot com
2024-06-26  7:31 ` [Bug c++/115656] [11/12/13/14/15 Regression] " rguenth at gcc dot gnu.org
2024-06-26 14:00 ` mpolacek at gcc dot gnu.org
2024-06-26 19:24 ` s.murthy at outlook 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-115656-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: 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).