public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95511] New: Class template argument deduction: guide generated from constructor preferred over deduction-guide.
@ 2020-06-03 18:37 okannen at gmail dot com
  2020-06-03 18:43 ` [Bug c++/95511] " okannen at gmail dot com
  2020-08-05  8:04 ` okannen at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: okannen at gmail dot com @ 2020-06-03 18:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95511
           Summary: Class template argument deduction: guide generated
                    from constructor preferred over deduction-guide.
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: okannen at gmail dot com
  Target Milestone: ---

This bug exists since gcc 7 and all following version. It also exists on the
current GCC-10 release branch.

The following code should compile:


template <class...Ts>
struct tpl
        {
        tpl (Ts...);
        };

template <class...Ts>
struct A 
        : tpl <Ts...>
        {
        template <class...Args>
        A (Args...args)
                : tpl <Ts...> (args...)
                {}
        };

template <class...Ts>
A (Ts...) -> A <Ts...>;

A a {10}; //error: no matching function for call to 'tpl<>::tpl(int&)'


Clang compile this code.

Maybe overload resolution considers that the guide generated from the
constructor of A is a better match than the one generated from the
deduction-guide.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/95511] Class template argument deduction: guide generated from constructor preferred over deduction-guide.
  2020-06-03 18:37 [Bug c++/95511] New: Class template argument deduction: guide generated from constructor preferred over deduction-guide okannen at gmail dot com
@ 2020-06-03 18:43 ` okannen at gmail dot com
  2020-08-05  8:04 ` okannen at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: okannen at gmail dot com @ 2020-06-03 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Olivier Kannengieser <okannen at gmail dot com> ---
Actualy it is a bug that happens during the selection of the best viable
function:

template <class...Ts>
void
func (auto...);

void
func (auto...);

void g(){
   func (10); // this should not compile
}

According to clang the call `func(10)` is ambiguous.

But GCC select fun<,int>. This is precisely what it does for the deduction
guide.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/95511] Class template argument deduction: guide generated from constructor preferred over deduction-guide.
  2020-06-03 18:37 [Bug c++/95511] New: Class template argument deduction: guide generated from constructor preferred over deduction-guide okannen at gmail dot com
  2020-06-03 18:43 ` [Bug c++/95511] " okannen at gmail dot com
@ 2020-08-05  8:04 ` okannen at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: okannen at gmail dot com @ 2020-08-05  8:04 UTC (permalink / raw)
  To: gcc-bugs

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

Olivier Kannengieser <okannen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Olivier Kannengieser <okannen at gmail dot com> ---
The bug is not more here in GCC version 10.2.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-05  8:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 18:37 [Bug c++/95511] New: Class template argument deduction: guide generated from constructor preferred over deduction-guide okannen at gmail dot com
2020-06-03 18:43 ` [Bug c++/95511] " okannen at gmail dot com
2020-08-05  8:04 ` okannen at gmail dot com

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).