public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97376] New: Function type to function pointer type adjustment for non-type template paramter does not work when using decltype(auto)
@ 2020-10-12  4:38 anders.granlund.0 at gmail dot com
  2020-10-26 16:57 ` [Bug c++/97376] Function type to function pointer type adjustment for non-type template parameter " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2020-10-12  4:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97376
           Summary: Function type to function pointer type adjustment for
                    non-type template paramter does not work when using
                    decltype(auto)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anders.granlund.0 at gmail dot com
  Target Milestone: ---

Consider the following program:

  #include <iostream>
  #include <type_traits>

  template<decltype(auto) X>
  void f1()
  {
  }

  template<void X()>
  void f2()
  {
  }

  void ff()
  {
  }

  int main()
  {
    f1<ff>();
    f2<ff>();
  }

When compiling it with  -std=c++17 -pedantic-errors  it gives a compilation
error complaining that the non-type parameter  X  of the template  f1  has type
 void ()  and that this is not a valid type for a non-type template paramter.

The expected behaviour is that the type of  X  in  f1  should instead be
ajusted to  void (*)() . This is what happens in template  f2 .

Note that clang gives the expected behaviour (no compilation errors). Compiler
explorer link comparing clang and gcc:

  https://godbolt.org/z/PGbrYE

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

end of thread, other threads:[~2021-11-02 20:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12  4:38 [Bug c++/97376] New: Function type to function pointer type adjustment for non-type template paramter does not work when using decltype(auto) anders.granlund.0 at gmail dot com
2020-10-26 16:57 ` [Bug c++/97376] Function type to function pointer type adjustment for non-type template parameter " mpolacek at gcc dot gnu.org
2020-10-26 17:07 ` mpolacek at gcc dot gnu.org
2021-11-02 20:27 ` 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).