public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56842] New: Argument deduction failure note is empty for alias template
@ 2013-04-04 14:30 redi at gcc dot gnu.org
  2013-04-11  2:41 ` [Bug c++/56842] " jason at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2013-04-04 14:30 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56842

             Bug #: 56842
           Summary: Argument deduction failure note is empty for alias
                    template
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org


For this code:

#include <type_traits>

struct Base { };

template<typename T>
struct Constraint1
: std::enable_if<std::is_base_of<Base, T>::value>
{ };

template <typename T,
         typename Requires = typename Constraint1<T>::type>
void foo() { }

struct A { };

int main()
{
    foo<A>();
}

GCC gives an excellent diagnostic:

b.cc: In function 'int main()':
b.cc:18:12: error: no matching function for call to 'foo()'
     foo<A>();
            ^
b.cc:18:12: note: candidate is:
b.cc:12:6: note: template<class T, class Requires> void foo()
 void foo() { }
      ^
b.cc:12:6: note:   template argument deduction/substitution failed:
b.cc:11:10: error: no type named 'type' in 'struct Constraint1<A>'
          typename Requires = typename Constraint1<T>::type>
          ^

However after changing it to use an alias template, which makes the declaration
of bar() much easier to read:

#include <type_traits>

struct Base { };

template<typename T>
  using Constraint2
    = typename std::enable_if<std::is_base_of<Base, T>::value>::type;

template <typename T,
         typename Requires = Constraint2<T>>
void bar() { }

struct A { };

int main()
{
    bar<A>();
}

GCC produces a useless diagnostic:

b.cc: In function 'int main()':
b.cc:16:12: error: no matching function for call to 'bar()'
     bar<A>();
            ^
b.cc:16:12: note: candidate is:
b.cc:10:6: note: template<class T, class Requires> void bar()
 void bar() { }
      ^
b.cc:10:6: note:   template argument deduction/substitution failed:


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

* [Bug c++/56842] Argument deduction failure note is empty for alias template
  2013-04-04 14:30 [Bug c++/56842] New: Argument deduction failure note is empty for alias template redi at gcc dot gnu.org
@ 2013-04-11  2:41 ` jason at gcc dot gnu.org
  2020-11-10 17:48 ` redi at gcc dot gnu.org
  2024-04-06 23:16 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2013-04-11  2:41 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56842

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dodji at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2013-04-11 02:41:22 UTC ---
Another alias issue.


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

* [Bug c++/56842] Argument deduction failure note is empty for alias template
  2013-04-04 14:30 [Bug c++/56842] New: Argument deduction failure note is empty for alias template redi at gcc dot gnu.org
  2013-04-11  2:41 ` [Bug c++/56842] " jason at gcc dot gnu.org
@ 2020-11-10 17:48 ` redi at gcc dot gnu.org
  2024-04-06 23:16 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-10 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |9.0

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed by r270433 for PR c++/90047 - ICE with enable_if alias template.

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

* [Bug c++/56842] Argument deduction failure note is empty for alias template
  2013-04-04 14:30 [Bug c++/56842] New: Argument deduction failure note is empty for alias template redi at gcc dot gnu.org
  2013-04-11  2:41 ` [Bug c++/56842] " jason at gcc dot gnu.org
  2020-11-10 17:48 ` redi at gcc dot gnu.org
@ 2024-04-06 23:16 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-06 23:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lucdanton at free dot fr

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

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

end of thread, other threads:[~2024-04-06 23:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 14:30 [Bug c++/56842] New: Argument deduction failure note is empty for alias template redi at gcc dot gnu.org
2013-04-11  2:41 ` [Bug c++/56842] " jason at gcc dot gnu.org
2020-11-10 17:48 ` redi at gcc dot gnu.org
2024-04-06 23:16 ` 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).