[llvm-bugs] [Bug 47358] New: clang reports an error:out-of-line definition of 'f' does not match any declaration

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 30 07:09:48 PDT 2020


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

            Bug ID: 47358
           Summary: clang reports an error:out-of-line definition of 'f'
                    does not match any declaration
           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

The following code is accepted by g++ with -std=c++2a, while is rejected by
clang++.

$ cat s.cpp
#include <concepts>

template <typename T>
class A
{
    using type = int;

    template <typename U>
    requires std::same_as<type, U>
    void f();
};

template <typename T>
template <typename U>
requires std::same_as<typename A<T>::type, U>
void A<T>::f(){}

$ g++ -c -std=c++2a s.cpp
success.

$ clang -v
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
ab4627364aefcaac751e757b721b7d07b48a545a)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang++ -c -std=c++2a s.cpp
s.cpp:16:12: error: out-of-line definition of 'f' does not match any
declaration in 'A<T>'
void A<T>::f(){}
           ^
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/20200830/59917274/attachment.html>


More information about the llvm-bugs mailing list