https://bugs.llvm.org/show_bug.cgi?id=48870
Bug ID: 48870
Summary: Accepts-invalid for requires-clauses on non-templated
function
Product: clang
Version: 11.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++2a
Assignee: unassignedclangb...@nondot.org
Reporter: davves...@gmail.com
CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk
As per [dcl.decl]/4 in N4861, a requires-clause shall be present only if the
declarator declares a templated function.
However, clang accepts the follow program:
void f() requires true { }
int main() { f(); }
and we may moreover note that constraint checking is actually enforced, as the
following program is rejected (for the wrong reasons) due to overload
resolution failure
void f() requires false { }
int main() { f(); } // // error: no matching function for call to 'f'
whereas the constraints have not been added to the function's signature (which
is correct, as per [defns.signature]):
void f() requires true { }
void f() requires false { }
// ^ error: definition with same mangled name '...' as another definition
---
(It may be that the implementation was base on [dcl.decl]/4 from the earlier
draft of N4810, which had a weaker requirement: allowing requires-clauses on
declarators that were functions).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs