public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102412] New: Template argument deduction fails when using concept as defaulted non-type template parameter
@ 2021-09-20 16:45 joeloser93 at gmail dot com
  2021-09-20 18:36 ` [Bug c++/102412] " ppalka at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: joeloser93 at gmail dot com @ 2021-09-20 16:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102412
           Summary: Template argument deduction fails when using concept
                    as defaulted non-type template parameter
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joeloser93 at gmail dot com
  Target Milestone: ---

When using a defaulted non-type template parameter whose value is from a
concept, GCC is unable to deduce the template correctly when calling the
function template. Clang accepts this code and it should be valid. 

```
#include <concepts>

template<class T, class U>
concept different_from = not std::is_same_v<T, U>;

template<class T, auto B = different_from<T, int>>
void f() {}

template<class T, auto B = not std::is_same_v<T, int>>
void g() {}

int main() {
    f<double>(); // fails to compile
    g<double>(); // compiles
}

```

See it live at https://godbolt.org/z/n1zrzGPoq

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

end of thread, other threads:[~2021-10-06 14:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 16:45 [Bug c++/102412] New: Template argument deduction fails when using concept as defaulted non-type template parameter joeloser93 at gmail dot com
2021-09-20 18:36 ` [Bug c++/102412] " ppalka at gcc dot gnu.org
2021-09-22 15:18 ` cvs-commit at gcc dot gnu.org
2021-10-06 14:15 ` cvs-commit at gcc dot gnu.org
2021-10-06 14:19 ` ppalka 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).