[llvm-bugs] [Bug 39008] New: Function pointer conversion with noexcept fails (c++17)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 19 14:37:06 PDT 2018


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: unassignedbugs at nondot.org
          Reporter: kittingj at synopsys.com
                CC: llvm-bugs at lists.llvm.org

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180919/5583cb81/attachment.html>


More information about the llvm-bugs mailing list