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

            Bug ID: 47414
           Summary: Premature substitution into constraints
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangb...@nondot.org
          Reporter: ca...@carter.net
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to