[llvm-bugs] [Bug 51831] New: Wrong template function definitions accepted

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 13 04:01:18 PDT 2021


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

            Bug ID: 51831
           Summary: Wrong template function definitions accepted
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2b
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fchelnokov 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

Wrong code as follows is accepted by Clang:
```
#include <iostream>

template<> //#1
void foo(auto x) { std::cout << x; };

template<> //#2
void foo(int) requires(false) { std::cout << "int"; };

int main() { foo(1); }
```

In #1, we have a template specialization, while no template function was
defined before.
In #2 we have `requires`-clause for not-template function.

Both #1 and #2 must be rejected.

-- 
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/20210913/cad8e43e/attachment.html>


More information about the llvm-bugs mailing list