[llvm-bugs] [Bug 38227] New: constexpr function call is not noexcept

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 19 09:14:17 PDT 2018


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

            Bug ID: 38227
           Summary: constexpr function call is not noexcept
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.vihrov at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Compiling the following code:

    constexpr int f()
    {
        return 0;
    }

    static_assert(noexcept(f()), "f() should be noexcept");

with "clang++ -std=c++11 -c x.cpp" gives:

x.cpp:6:1: error: static_assert failed due to requirement 'noexcept(f())' "f()
should be noexcept"
static_assert(noexcept(f()), "f() should be noexcept");
^             ~~~~~~~~~~~~~
1 error generated.

According to https://en.cppreference.com/w/cpp/language/noexcept, it would
appear the assert should succeed, because "f()" is a constant expression. GCC
8.1 accepts the code.

clang --version:

clang version 6.0.1 (tags/RELEASE_601/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

-- 
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/20180719/69030faf/attachment.html>


More information about the llvm-bugs mailing list