Using constraint variables in requirement-parameter-list as type requirements

41 views
Skip to first unread message

Anton Bikineev

unread,
Jun 1, 2016, 8:23:10 PM6/1/16
to SG8 - Concepts
I don't know whether this question has been raised or not, but I wonder if it's possible to declare and use the following:
template <class T>
concept bool has_type = requires (typename T::type t) { /*other requirements*/ };


In existing gcc implementation (from trunk) a constraint defined by this concept satisfies even if T doesn't have nested type.
According to N4553, 14.10.1.8.2,

A parameterized constraint is satisfied if and only if substitution into the types of its constraint

variables does not result in an invalid type, and its operand is satisfied.

so it shouldn't satisfy.
Is it bug in current implementation in GCC or am I getting something wrong?

Thanks!

Ryan Burn

unread,
Jun 1, 2016, 9:48:45 PM6/1/16
to conc...@isocpp.org
This question on SO addresses that same problem
(http://stackoverflow.com/questions/32801326/in-requires-parameter-lists-can-you-introduce-types-that-result-in-substitution)

And there's a bug report
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67727) for the issue.
> --
> You received this message because you are subscribed to the Google Groups
> "SG8 - Concepts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to concepts+u...@isocpp.org.
> To post to this group, send email to conc...@isocpp.org.
> Visit this group at https://groups.google.com/a/isocpp.org/group/concepts/.

Anton Bikineev

unread,
Jun 2, 2016, 5:46:04 AM6/2/16
to SG8 - Concepts
Ryan,
Thanks for reponse, much appreciated.

четверг, 2 июня 2016 г., 4:48:45 UTC+3 пользователь Ryan Burn написал:
Reply all
Reply to author
Forward
0 new messages