[llvm-bugs] [Bug 47250] New: clang does not expect requires expression

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 20 04:54:25 PDT 2020


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

            Bug ID: 47250
           Summary: clang  does not expect requires expression
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tangyixuan at mail.dlut.edu.cn
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Compiling the following code with -std=c++2a, GCC accepts, while clang rejects.
Clang also rejects with -std=c++11/17.

$ cat s.C

template<class T>
bool f(T t) {
  return requires(T t) {
    ++t;
  };
}

int main() {
  f(0);
  return 0;
}

$ g++ -std=c++2a -c s.C
no errors.

$ clang++ std=c++2a -c s.C
s.C:3:19: error: 'T' does not refer to a value
  return requires(T x) {
                  ^
s.C:1:16: note: declared here
template<class T>
               ^
1 error generated.

-- 
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/20200820/cbbc6f09/attachment.html>


More information about the llvm-bugs mailing list