[llvm-bugs] [Bug 51302] New: Incorrect output contradicting static_assert's

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 2 02:25:59 PDT 2021


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

            Bug ID: 51302
           Summary: Incorrect output contradicting static_assert's
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fchelnokov at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The following correct code:
```
#include <iostream>

constexpr int p(auto) { return 0; }
constexpr int q() { return p(0); }
constexpr int p(auto) requires true { return 1; }

static_assert(p(0) == 1);
static_assert(q() == 0);

int main()
{
    std::cout << q() << p(0) << '\n';
}
```
incorrectly prints `11` in Clang despite of static_assert's.

-- 
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/20210802/bd14722c/attachment.html>


More information about the llvm-bugs mailing list