[llvm-bugs] [Bug 45219] New: non-bool expression allowed in requires clause

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 16 15:51:46 PDT 2020


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

            Bug ID: 45219
           Summary: non-bool expression allowed in requires clause
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: akrzemi1 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

Clang trunk compiles the following invalid C++20 code.

```
#include <string>
#include <iostream>

template <typename T>
  requires T::operator int 
std::string  fun(T) { std::cout << 1; } 

template <typename T>
void fun(T) { std::cout << 0; } 

int main()
{
  fun(1);  // expected hard compiler error
}
```

It should not compile because expression `T::operator int` does not have type
bool.

-- 
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/20200316/4092a802/attachment.html>


More information about the llvm-bugs mailing list