https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81178

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-08-21
                 CC|                            |egallager at gcc dot gnu.org
             Blocks|                            |67491
     Ever confirmed|0                           |1

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Casey Carter from comment #0)
> GCC 6.3/7.1/trunk as of 20170621 all diagnose this ill-formed program
> (https://wandbox.org/permlink/uatmNSnlLbhvSvls):
> 
> template<class>
> concept bool C1 = true;
> 
> template<class T>
> using alias = typename T::type;
> 
> template<class T>
> concept bool C2 = C1<alias<T>>;
> 
> void bar(C2) {}
> 
> int main() { bar(42); }
> 
> with:
> 
> prog.cc: In function 'int main()':
> prog.cc:12:20: error: cannot call function 'void bar(auto:1) [with auto:1 =
> int]'
>  int main() { bar(42); }
>                     ^
> prog.cc:10:6: note:   constraints not satisfied
>  void bar(C2) {}
>       ^~~
> prog.cc:10:6: note: in the expansion of concept 'C2<auto:1> template<class
> T> concept const bool C2<T> [with T = int]'
> 
> (Yes, that is the entire diagnostic.)

Confirmed for this first testcase.

> If we expand the definition of C2 fully into bar
> (https://wandbox.org/permlink/GKW0vWSPIY5XrGRE):
> 
> template<class T>
>   requires C1<alias<T>>
> void bar(T) {}
> 
> the compiler gives a more complete diagnostic:
> 
> prog.cc: In function 'int main()':
> prog.cc:14:20: error: cannot call function 'void bar(T) [with T = int]'
>  int main() { bar(42); }
>                     ^
> prog.cc:12:6: note:   constraints not satisfied
>  void bar(T) {}
>       ^~~
> prog.cc:12:6: note: invalid use of the concept 'C1<typename T::type>'
> prog.cc:14:20: error: 'int' is not a class, struct, or union type
>  int main() { bar(42); }
>                     ^

...and actually confirmed for this second part, too. (At first I thought it was
a separate standalone testcase, and when compiling it like that it gave me a
different error, but then I noticed it was actually a modification to the first
one, so after modifying the first one accordingly, I got the same result as you
did.)


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

Reply via email to