[llvm-bugs] [Bug 47377] New: Function pointer types defined using std::declval cannot be default initialized in a struct

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 31 18:51:08 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47377

            Bug ID: 47377
           Summary: Function pointer types defined using std::declval
                    cannot be default initialized in a struct
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: insertinterestingnamehere at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The following should compile fine, but errors out with versions more recent
than 6. Versions 3.4 through 6 emit an erroneous diagnostic. 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/YKET67.


#include <utility>

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

struct S {
  function_type fptr = nullptr;
};

int main() {
    S thing;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200901/5f73dda6/attachment-0001.html>


More information about the llvm-bugs mailing list