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

* [Bug c++/97376] Function type to function pointer type adjustment for non-type template parameter does not work when using decltype(auto)
  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 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-26 16:57 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-10-26

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think we have a similar PR pro this somewhere, but I'm not finding it now.

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

* [Bug c++/97376] Function type to function pointer type adjustment for non-type template parameter does not work when using decltype(auto)
  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
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-26 17:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
s/pro/for/

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

* [Bug c++/97376] Function type to function pointer type adjustment for non-type template parameter does not work when using decltype(auto)
  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
  2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-11-02 20:27 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
                 CC|                            |ppalka at gcc dot gnu.org
   Target Milestone|---                         |12.0

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12 with r12-4238 aka the fix for PR61355

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