[llvm-bugs] [Bug 48870] New: Accepts-invalid for requires-clauses on non-templated function
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Mon Jan 25 02:39:55 PST 2021
    
    
  
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: unassignedclangbugs at nondot.org
          Reporter: davveston 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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210125/d6d8de75/attachment.html>
    
    
More information about the llvm-bugs
mailing list