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

            Bug ID: 39008
           Summary: Function pointer conversion with noexcept fails
                    (c++17)
           Product: new-bugs
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

Created attachment 20894
  --> https://bugs.llvm.org/attachment.cgi?id=20894&action=edit
repro source file

Given the code: (also in repro.cpp attachment):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void noexcept_function_pointer_is_converted_to_function_pointer1() {
    void (*p)() noexcept;
    void (**pp)() = &p;
}

class C{};

void
noexcept_member_function_pointer_is_converted_to_member_function_pointer1() {
    void (C::*p)() noexcept;
    void (C::**pp)() = &p;
}

struct S2 {
    typedef void (C::*p)() noexcept;
    operator p();
};

void
noexcept_member_function_pointer_is_converted_to_member_function_pointer2() {
    void (C::*q)() = S2();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gcc (7.1) accepts the source
$ g++ -c -std=c++17 repro.cpp (no errors)

clang (6.0) errors with
$ clang++ -c -std=c++17 repro.cpp
repro.cpp:3:13: error: cannot initialize a variable of type 'void (**)()' with
an rvalue of type 'void (**)() noexcept'
    void (**pp)() = &p;
            ^       ~~
repro.cpp:10:16: error: cannot initialize a variable of type 'void (C::**)()'
with an rvalue of type 'void (C::**)() noexcept': different
      exception specifications
    void (C::**pp)() = &p;
               ^       ~~
2 errors generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to