Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang "error: requires clause differs in template redeclaration" on out-of-class definition of class template specialization member #60704

Closed
stbergmann opened this issue Feb 13, 2023 · 3 comments
Labels
c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" concepts C++20 concepts duplicate Resolved as duplicate

Comments

@stbergmann
Copy link
Collaborator

At least with recent Clang 17 trunk:

$ cat test.cc
template<typename T> concept C1 = requires(T t) { --t; };
template<typename T> concept C2 = C1<T> && requires(T t) { *t; };
template<typename T> requires C1<T> struct S { void f(); };
template<typename T> requires C2<T> struct S<T> { void f(); };
template<typename T> requires C1<T> void S<T>::f() {}
template<typename T> requires C2<T> void S<T>::f() {}
$ clang++ -std=c++20 -fsyntax-only test.cc
test.cc:22:48: error: redefinition of 'f'
template<typename T> requires C1<T> void S<T>::f() {}
                                               ^
test.cc:21:48: note: previous definition is here
template<typename T> requires C1<T> void S<T>::f() {}
                                               ^
1 error generated.

(This causes issues with libstdc++, see https://gcc.gnu.org/pipermail/libstdc++/2023-February/055442.html "Re: <ranges> error: requires clause differs in template redeclaration".)

@stbergmann stbergmann added the clang Clang issues not falling into any other category label Feb 13, 2023
@jwakely
Copy link
Contributor

jwakely commented Feb 13, 2023

Dup of #58124 which is a dup of #49620

@stbergmann stbergmann added the duplicate Resolved as duplicate label Feb 13, 2023
@EugeneZelenko EugeneZelenko added c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" concepts C++20 concepts and removed clang Clang issues not falling into any other category labels Feb 13, 2023
@EugeneZelenko EugeneZelenko closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 13, 2023

@llvm/issue-subscribers-clang-frontend

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 13, 2023

@llvm/issue-subscribers-c-20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" concepts C++20 concepts duplicate Resolved as duplicate
Projects
Status: No status
Development

No branches or pull requests

4 participants