[llvm-bugs] [Bug 35376] New: noexcept for a class member function are missed when the function pass over template argument.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 21 13:19:32 PST 2017


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

            Bug ID: 35376
           Summary: noexcept for a class member function are missed when
                    the function pass over template argument.
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: blackmatov at gmail.com
                CC: llvm-bugs at lists.llvm.org

This happens only with -std=c++14 and -std=c++11 flags, but with -std=c++1z
flag is all good.

Link to wandbox demonstration: https://wandbox.org/permlink/xHdPq2R0deTqQ6KG

struct foo {
    void boo() noexcept {}
} foo_;

template < typename F >
void should_be_noexcept(F f, foo& t) noexcept(noexcept((t.*f)())) {
    (t.*f)();
}

int main() {
    void (foo::*f)() noexcept = &foo::boo;
    static_assert(noexcept((foo_.*f)()), "%-)");                            //
1 safe noexcept
    static_assert(noexcept(should_be_noexcept(&foo::boo, foo_)), "no :-("); //
2 miss noexcept
    return 0;
}

-- 
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/20171121/b3029384/attachment.html>


More information about the llvm-bugs mailing list