This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [c++-concepts] requires expression semantics
- From: Jason Merrill <jason at redhat dot com>
- To: Andrew Sutton <andrew dot n dot sutton at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Gabriel Dos Reis <gdr at axiomatics dot org>
- Date: Wed, 03 Jul 2013 09:20:49 -0700
- Subject: Re: [c++-concepts] requires expression semantics
- References: <CANq5SyvWKM8dm_Qaiu2_UHqXyWU=6tetPrEwhuZH3i+DYd42Xg at mail dot gmail dot com> <51CC7AC4 dot 9070400 at redhat dot com> <CANq5Syu9hxwKk8qma1Chc3NtqdtU9+EKjAzs3ZusTmYN5Q18Kg at mail dot gmail dot com>
On 07/01/2013 01:27 PM, Andrew Sutton wrote:
Unfortunately, the behavior differs from the test suite for
std::is_convertible. In particular, this fails:
static_assert(__is_convertible_to(int(int), int(&)(int)), "");
whereas this succeeds )
static_assert(is_convertible<int(int), int(&)(int)>::value, "");
Hmm, that probably has to do with reference decay; we don't handle
conversion from reference type everywhere because there are no
expressions of reference type. So perhaps in the case of REFERENCE_TYPE
can_convert should build a dummy expression and call
convert_from_reference; did your CAST_EXPR work for this test?
In the formal model I'm designing, __is_valid_expr(e) evaluates to
true when e has a type. Although, if I'm instantiating a non-dependent
expression, I'll probably get an error_mark_node if the expression
can't be typed. Right?
Right. Any expression either has a type, is type-dependent, or is
erroneous; any erroneous expression will show up as error_mark_node.
+/* The REQ expressions are unary expressions that specify inididual
"individual"
+ // evaluatd.
"evaluated"
Jason