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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to