public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/79070] Unhelpful error message for ambiguous type in template parameter
       [not found] <bug-79070-4@http.gcc.gnu.org/bugzilla/>
@ 2021-03-29 22:44 ` barry.revzin at gmail dot com
  2021-03-30 10:41 ` redi at gcc dot gnu.org
  2021-12-14  5:47 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: barry.revzin at gmail dot com @ 2021-03-29 22:44 UTC (permalink / raw)
  To: gcc-bugs

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

Barry Revzin <barry.revzin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |barry.revzin at gmail dot com

--- Comment #3 from Barry Revzin <barry.revzin at gmail dot com> ---
Here are a few more cases, reduced from a larger example that took me a very
long time to understand. I'm adding as comments the compile error emitted for
each invalid use:

namespace N {
    template <typename T, typename U, typename V> struct Something { };
    template <typename> concept C = true;
    template <typename> struct X { };
}

using namespace N;
template <typename T> struct Something { };

// parse error in template argument list
static_assert(C<Something<int>>);

// template argument 1 is invalid
X<Something<int>> x;

// reference to Something is ambiguous
using T = Something<int>;

In the last case, the compiler error is super clear and it is obvious what the
error is. In the other two, not so much.

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

* [Bug c++/79070] Unhelpful error message for ambiguous type in template parameter
       [not found] <bug-79070-4@http.gcc.gnu.org/bugzilla/>
  2021-03-29 22:44 ` [Bug c++/79070] Unhelpful error message for ambiguous type in template parameter barry.revzin at gmail dot com
@ 2021-03-30 10:41 ` redi at gcc dot gnu.org
  2021-12-14  5:47 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-03-30 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2017-02-08 00:00:00         |2021-3-30

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For Barry's example, Clang gives the exact same error in all three cases, which
is much more useful:


79070.C:11:17: error: reference to 'Something' is ambiguous
static_assert(C<Something<int>>);
                ^
79070.C:8:30: note: candidate found by name lookup is 'Something'
template <typename T> struct Something { };
                             ^
79070.C:2:58: note: candidate found by name lookup is 'N::Something'
    template <typename T, typename U, typename V> struct Something { };
                                                         ^
79070.C:14:3: error: reference to 'Something' is ambiguous
X<Something<int>> x;
  ^
79070.C:8:30: note: candidate found by name lookup is 'Something'
template <typename T> struct Something { };
                             ^
79070.C:2:58: note: candidate found by name lookup is 'N::Something'
    template <typename T, typename U, typename V> struct Something { };
                                                         ^
79070.C:17:11: error: reference to 'Something' is ambiguous
using T = Something<int>;
          ^
79070.C:8:30: note: candidate found by name lookup is 'Something'
template <typename T> struct Something { };
                             ^
79070.C:2:58: note: candidate found by name lookup is 'N::Something'
    template <typename T, typename U, typename V> struct Something { };
                                                         ^
3 errors generated.

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

* [Bug c++/79070] Unhelpful error message for ambiguous type in template parameter
       [not found] <bug-79070-4@http.gcc.gnu.org/bugzilla/>
  2021-03-29 22:44 ` [Bug c++/79070] Unhelpful error message for ambiguous type in template parameter barry.revzin at gmail dot com
  2021-03-30 10:41 ` redi at gcc dot gnu.org
@ 2021-12-14  5:47 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-14  5:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harry.linxd at gmail dot com

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 97922 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2021-12-14  5:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-79070-4@http.gcc.gnu.org/bugzilla/>
2021-03-29 22:44 ` [Bug c++/79070] Unhelpful error message for ambiguous type in template parameter barry.revzin at gmail dot com
2021-03-30 10:41 ` redi at gcc dot gnu.org
2021-12-14  5:47 ` pinskia at gcc dot gnu.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).