[llvm-bugs] [Bug 50205] New: 12 regression: no return statement in constexpr function

via llvm-bugs llvm-bugs at lists.llvm.org
Mon May 3 02:32:23 PDT 2021


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

            Bug ID: 50205
           Summary: 12 regression: no return statement in constexpr
                    function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hewillk at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

constexpr double pow(double x, long long n) noexcept {
    if (n > 0) [[likely]]
        return x * pow(x, n - 1);
    else [[unlikely]]
        return 1;
}
constexpr long long fact(long long n) noexcept {
    if (n > 1) [[likely]]
        return n * fact(n - 1);
    else [[unlikely]]
        return 1;
}

<source>:1:18: error: no return statement in constexpr function
constexpr double pow(double x, long long n) noexcept {
                 ^
<source>:7:21: error: no return statement in constexpr function
constexpr long long fact(long long n) noexcept {
                    ^

https://godbolt.org/z/ezMsrhrxo

-- 
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/20210503/910e26ee/attachment.html>


More information about the llvm-bugs mailing list