public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96877] New: Erroneous warning when default initializing function pointer types defined using std::declval
@ 2020-09-01  2:07 insertinterestingnamehere at gmail dot com
  2020-09-01 15:29 ` [Bug c++/96877] " insertinterestingnamehere at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: insertinterestingnamehere at gmail dot com @ 2020-09-01  2:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96877
           Summary: Erroneous warning when default initializing function
                    pointer types defined using std::declval
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: insertinterestingnamehere at gmail dot com
  Target Milestone: ---

When compiling the following with -Wextra (C++11 and later, all recent version
of gcc) the compiler emits an erroneous warning about binding a temporary in a
constructor. Note: this works fine if function_type is declared as a plain
typedef instead of using decltype and std::declval. See
https://godbolt.org/z/sjKdP5.



#include <utility>

using function_type = decltype(std::declval<void (*)(void*) noexcept>());

struct S {
  function_type fptr = nullptr;
};

int main() {
    S thing;
}

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

end of thread, other threads:[~2020-09-02 16:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01  2:07 [Bug c++/96877] New: Erroneous warning when default initializing function pointer types defined using std::declval insertinterestingnamehere at gmail dot com
2020-09-01 15:29 ` [Bug c++/96877] " insertinterestingnamehere at gmail dot com
2020-09-01 17:37 ` redi at gcc dot gnu.org
2020-09-01 19:19 ` insertinterestingnamehere at gmail dot com
2020-09-01 19:25 ` insertinterestingnamehere at gmail dot com
2020-09-02  8:51 ` redi at gcc dot gnu.org
2020-09-02 16:51 ` insertinterestingnamehere at gmail dot com

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