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

Class template specialisation doesn't always require constraints to match #63157

Open
cjdb opened this issue Jun 6, 2023 · 5 comments
Open
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" concepts C++20 concepts

Comments

@cjdb
Copy link
Contributor

cjdb commented Jun 6, 2023

GCC test case concepts-ttp.C fails on Clang.

// PR c++/99904
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s

template<class... Ts> concept C = (Ts::value && ...);
template<class... Ts> requires C<Ts...> struct A;
template<class T> requires true struct B;
template<template<class... Ts> requires C<Ts...> class TT> struct S;
using ty1 = S<A>;
using ty2 = S<B>; // expected-error{{}}
@cjdb cjdb added clang:frontend Language frontend issues, e.g. anything involving "Sema" concepts C++20 concepts labels Jun 6, 2023
@llvmbot
Copy link
Member

llvmbot commented Jun 6, 2023

@llvm/issue-subscribers-clang-frontend

@cor3ntin
Copy link
Contributor

cor3ntin commented Jun 7, 2023

@erichkeane I'm still confused by template template parameter constraints. Should they match?

@erichkeane
Copy link
Collaborator

Its not clear to me what the answer should be here. I THINK all we end up doing is checking 'C' at each case, which is true? But MSVC seems to agree with us: https://godbolt.org/z/Tve4Gd61c

@cor3ntin
Copy link
Contributor

@mizvekov

@mizvekov
Copy link
Contributor

Yeah this is one case I pointed out in a recent core reflector thread about divergence in the handling of constraints on the exact match fallback.

Technically clang is correct in ignoring the constraints on this fallback, but to me this is clearly undesirable.

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

No branches or pull requests

5 participants