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

Premature substitution into constraints #46758

Closed
CaseyCarter opened this issue Sep 4, 2020 · 1 comment
Closed

Premature substitution into constraints #46758

CaseyCarter opened this issue Sep 4, 2020 · 1 comment
Labels
bugzilla Issues migrated from bugzilla c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@CaseyCarter
Copy link
Member

Bugzilla Link 47414
Version trunk
OS Windows NT
CC @zygoloid

Extended Description

Compiling this program:

template <class, class> constexpr bool is_same_v = false;
template <class T> constexpr bool is_same_v<T, T> = true;

template <class T> concept C = is_same_v<T, void>;

template <class T> requires C<T> using alias = T;

template <class T> struct S {
    void f() requires C<T> && is_same_v<alias<T>, void> {}
};

int main() { S<int>{}; }

with "clang++ -std=c++2a" diagnoses (https://godbolt.org/z/qhhec8):

<source>:9:41: error: constraints not satisfied for alias template 'alias' [with T = int]
    void f() requires C<T> && is_same_v<alias<T>, void> {}
                                        ^~~~~~~~
<source>:12:14: note: in instantiation of template class 'S<int>' requested here
int main() { S<int>{}; }
             ^
<source>:6:29: note: because 'int' does not satisfy 'C'
template <class T> requires C<T> using alias = T;
                            ^
<source>:4:32: note: because 'is_same_v<int, void>' evaluated to false
template <class T> concept C = is_same_v<T, void>;
                               ^

Despite that C<T> is unsatisfied, the compiler is substituting into the conjoined is_same_v<alias<T>, void> atomic constraint.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@EugeneZelenko EugeneZelenko added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Oct 13, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Oct 13, 2022

@llvm/issue-subscribers-clang-frontend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
Status: Done
Development

No branches or pull requests

4 participants