public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103684] New: Ambiguous template template overload resolution
@ 2021-12-13 13:14 weidmann at acm dot org
  2021-12-13 13:22 ` [Bug c++/103684] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: weidmann at acm dot org @ 2021-12-13 13:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103684
           Summary: Ambiguous template template overload resolution
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: weidmann at acm dot org
  Target Milestone: ---

The following code compiles with -std=c++11, but does not with -std=c++17.
Works with clang.

#include <list>
#include <set>

template<template<typename, typename> typename T> constexpr std::size_t hello()
{
    return 2;
}

template<template<typename, typename, typename> typename T> constexpr
std::size_t hello()
{
    return 3;
}

void foo()
{
    auto i = hello<std::list>();
    auto j = hello<std::set>();
}

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

* [Bug c++/103684] Ambiguous template template overload resolution
  2021-12-13 13:14 [Bug c++/103684] New: Ambiguous template template overload resolution weidmann at acm dot org
@ 2021-12-13 13:22 ` pinskia at gcc dot gnu.org
  2021-12-13 13:31 ` pinskia at gcc dot gnu.org
  2021-12-13 13:41 ` weidmann at acm dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-13 13:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
template <class T, class T1 = int, class T2 = int> struct f{};
template <class T, class T1 = int> struct g{};
template<template<typename, typename> class T> constexpr int hello()
{
    return 2;
}
template<template<typename, typename, typename> class T> constexpr int hello()
{
    return 3;
}
void foo()
{
    auto i = hello<g>();
    auto j = hello<f>();
}

----- CUT -----
I think clang here is wrong, MSVC and ICC both reject it for the same reason as
GCC.  Basically it looks like clang is not taking into account the default
template arugments.

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

* [Bug c++/103684] Ambiguous template template overload resolution
  2021-12-13 13:14 [Bug c++/103684] New: Ambiguous template template overload resolution weidmann at acm dot org
  2021-12-13 13:22 ` [Bug c++/103684] " pinskia at gcc dot gnu.org
@ 2021-12-13 13:31 ` pinskia at gcc dot gnu.org
  2021-12-13 13:41 ` weidmann at acm dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-13 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#150
[Moved to DR at the November, 2016 meeting as paper P0522R0.]

[Picked up by evolution group at October 2002 meeting.]


paper P0522R0:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0522r0.html

Anyways this used to be a GCC extension which was removed and then added back
as part of the C++ standard.  GCC is correct here in C++17 and above.

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

* [Bug c++/103684] Ambiguous template template overload resolution
  2021-12-13 13:14 [Bug c++/103684] New: Ambiguous template template overload resolution weidmann at acm dot org
  2021-12-13 13:22 ` [Bug c++/103684] " pinskia at gcc dot gnu.org
  2021-12-13 13:31 ` pinskia at gcc dot gnu.org
@ 2021-12-13 13:41 ` weidmann at acm dot org
  2 siblings, 0 replies; 4+ messages in thread
From: weidmann at acm dot org @ 2021-12-13 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Nicolas Weidmann <weidmann at acm dot org> ---
Ok, thanks for the update!

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

end of thread, other threads:[~2021-12-13 13:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13 13:14 [Bug c++/103684] New: Ambiguous template template overload resolution weidmann at acm dot org
2021-12-13 13:22 ` [Bug c++/103684] " pinskia at gcc dot gnu.org
2021-12-13 13:31 ` pinskia at gcc dot gnu.org
2021-12-13 13:41 ` weidmann at acm dot org

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