Topic: elaborated type specifiers + temporaries
Author: Ion Todirel <iontodirel@gmail.com>
Date: Tue, 17 Jan 2017 23:03:12 -0800 (PST)
Raw View
------=_Part_6900_864546391.1484722992645
Content-Type: multipart/alternative;
boundary="----=_Part_6901_772117332.1484722992645"
------=_Part_6901_772117332.1484722992645
Content-Type: text/plain; charset=UTF-8
The following code compiles in gcc, clang and vc:
struct S { S(int) {} };
void S(int) {}
int main()
{
S(1); // ok, calls S(int)
(struct S)(1); // ok, calls S::S(int)
struct S s(1); // ok, calls S::S(int)
return 0;
}
I couldn't find a place where creating a temporary using an elaborated type
specifier is called out in the standard. Specifically the parans syntax. Is
this implied due to some other rule, or is it a bug in the compilers that
the form is supported? Or should be a bug in the standard if not specified?
Thanks
-Ion
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%40isocpp.org.
------=_Part_6901_772117332.1484722992645
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">The following code compiles in gcc, clang and vc:<div><br>=
</div><div><div>struct S { S(int) {} };</div><div>void S(int) {}</div><div>=
<br></div><div>int main()</div><div>{</div><div>=C2=A0 =C2=A0 S(1); // ok, =
calls S(int)</div><div>=C2=A0 =C2=A0 (struct S)(1); // ok, calls S::S(int) =
=C2=A0</div><div>=C2=A0 =C2=A0 struct S s(1); // ok, calls S::S(int)</div><=
div>=C2=A0 =C2=A0 return 0;</div><div>}</div></div><div><br></div><div>I co=
uldn't find a place where creating a temporary using an elaborated type=
specifier is called out in the standard. Specifically the parans syntax. I=
s this implied due to some other rule, or is it a bug in the compilers that=
the form is supported? Or should be a bug in the standard if not specified=
?</div><div><br></div><div>Thanks</div><div>-Ion</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b=
%40isocpp.org</a>.<br />
------=_Part_6901_772117332.1484722992645--
------=_Part_6900_864546391.1484722992645--
.
Author: Brian Bi <bbi5291@gmail.com>
Date: Tue, 17 Jan 2017 23:57:30 -0800
Raw View
--001a114acbf0c9901c054659c48f
Content-Type: text/plain; charset=UTF-8
The standard doesn't have to explicitly say that you are allowed to use an
elaborated type specifier since an elaborated type specifier is just one
particular way of naming a class type. If you have any doubts you can
always read the grammar:
*cast-expression:*
* unary-expression*
(* type-id *)
* cast-expression*
An *elaborated-type-specifier* is a valid *type-id*.
On Tue, Jan 17, 2017 at 11:03 PM, Ion Todirel <iontodirel@gmail.com> wrote:
> The following code compiles in gcc, clang and vc:
>
> struct S { S(int) {} };
> void S(int) {}
>
> int main()
> {
> S(1); // ok, calls S(int)
> (struct S)(1); // ok, calls S::S(int)
> struct S s(1); // ok, calls S::S(int)
> return 0;
> }
>
> I couldn't find a place where creating a temporary using an elaborated
> type specifier is called out in the standard. Specifically the parans
> syntax. Is this implied due to some other rule, or is it a bug in the
> compilers that the form is supported? Or should be a bug in the standard if
> not specified?
>
> Thanks
> -Ion
>
> --
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-
> 88cb-d39eed5d9b0b%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
*Brian Bi*
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMmfjbOVQ9Cz4qgrRyrg3aC%2BFr9NpU-MEVn9grzC1Ezv%2BFk0EA%40mail.gmail.com.
--001a114acbf0c9901c054659c48f
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><div><div>The standard doesn't have to explicitly=
say that you are allowed to use an elaborated type specifier since an elab=
orated type specifier is just one particular way of naming a class type. If=
you have any doubts you can always read the grammar:<br></div><div><br><i>=
cast-expression:<br></i></div><i>=C2=A0=C2=A0=C2=A0 unary-expression<br></i=
></div><i>=C2=A0=C2=A0=C2=A0 </i><span style=3D"font-family:monospace,monos=
pace">(</span><i> type-id </i><span style=3D"font-family:monospace,monospac=
e">)</span><i> cast-expression<br><br></i></div>An <i>elaborated-type-speci=
fier</i> is a valid <i>type-id</i>.<br></div><div class=3D"gmail_extra"><br=
><div class=3D"gmail_quote">On Tue, Jan 17, 2017 at 11:03 PM, Ion Todirel <=
span dir=3D"ltr"><<a href=3D"mailto:iontodirel@gmail.com" target=3D"_bla=
nk">iontodirel@gmail.com</a>></span> wrote:<br><blockquote class=3D"gmai=
l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left=
:1ex"><div dir=3D"ltr">The following code compiles in gcc, clang and vc:<di=
v><br></div><div><div>struct S { S(int) {} };</div><div>void S(int) {}</div=
><div><br></div><div>int main()</div><div>{</div><div>=C2=A0 =C2=A0 S(1); /=
/ ok, calls S(int)</div><div>=C2=A0 =C2=A0 (struct S)(1); // ok, calls S::S=
(int) =C2=A0</div><div>=C2=A0 =C2=A0 struct S s(1); // ok, calls S::S(int)<=
/div><div>=C2=A0 =C2=A0 return 0;</div><div>}</div></div><div><br></div><di=
v>I couldn't find a place where creating a temporary using an elaborate=
d type specifier is called out in the standard. Specifically the parans syn=
tax. Is this implied due to some other rule, or is it a bug in the compiler=
s that the form is supported? Or should be a bug in the standard if not spe=
cified?</div><div><br></div><div>Thanks</div><span class=3D"HOEnZb"><font c=
olor=3D"#888888"><div>-Ion</div></font></span></div><span class=3D"HOEnZb">=
<font color=3D"#888888">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/f7ad=
5e63-cf22-4d65-<wbr>88cb-d39eed5d9b0b%40isocpp.org</a><wbr>.<br>
</font></span></blockquote></div><br><br clear=3D"all"><br>-- <br><div clas=
s=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><=
div><div dir=3D"ltr"><font color=3D"#c0c0c0"><i>Brian Bi</i></font><br><div=
></div><div></div><div></div></div></div></div></div>
</div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAMmfjbOVQ9Cz4qgrRyrg3aC%2BFr9NpU-MEV=
n9grzC1Ezv%2BFk0EA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMmfjbOVQ9Cz=
4qgrRyrg3aC%2BFr9NpU-MEVn9grzC1Ezv%2BFk0EA%40mail.gmail.com</a>.<br />
--001a114acbf0c9901c054659c48f--
.
Author: Ion Todirel <iontodirel@gmail.com>
Date: Wed, 18 Jan 2017 10:41:53 -0800 (PST)
Raw View
------=_Part_7552_1888787647.1484764913888
Content-Type: multipart/alternative;
boundary="----=_Part_7553_1973918832.1484764913888"
------=_Part_7553_1973918832.1484764913888
Content-Type: text/plain; charset=UTF-8
it's not an expression though, I specifically meant the temporary, this is
not allowed for example: "struct S(1)", the parans around "(struct S)" are
required
On Tuesday, January 17, 2017 at 11:57:33 PM UTC-8, Brian Bi wrote:
>
> The standard doesn't have to explicitly say that you are allowed to use an
> elaborated type specifier since an elaborated type specifier is just one
> particular way of naming a class type. If you have any doubts you can
> always read the grammar:
>
>
> *cast-expression:*
>
> * unary-expression*
> (* type-id *)
>
> * cast-expression*
> An *elaborated-type-specifier* is a valid *type-id*.
>
> On Tue, Jan 17, 2017 at 11:03 PM, Ion Todirel <ionto...@gmail.com
> <javascript:>> wrote:
>
>> The following code compiles in gcc, clang and vc:
>>
>> struct S { S(int) {} };
>> void S(int) {}
>>
>> int main()
>> {
>> S(1); // ok, calls S(int)
>> (struct S)(1); // ok, calls S::S(int)
>> struct S s(1); // ok, calls S::S(int)
>> return 0;
>> }
>>
>> I couldn't find a place where creating a temporary using an elaborated
>> type specifier is called out in the standard. Specifically the parans
>> syntax. Is this implied due to some other rule, or is it a bug in the
>> compilers that the form is supported? Or should be a bug in the standard if
>> not specified?
>>
>> Thanks
>> -Ion
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%40isocpp.org
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%40isocpp.org?utm_medium=email&utm_source=footer>
>> .
>>
>
>
>
> --
> *Brian Bi*
>
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-8563-6f9798f9d0a5%40isocpp.org.
------=_Part_7553_1973918832.1484764913888
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">it's not an expression though, I specifically meant th=
e temporary, this is not allowed for example: "struct S(1)", the =
parans around "(struct S)" are required<br><br>On Tuesday, Januar=
y 17, 2017 at 11:57:33 PM UTC-8, Brian Bi wrote:<blockquote class=3D"gmail_=
quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pa=
dding-left: 1ex;"><div dir=3D"ltr"><div><div><div>The standard doesn't =
have to explicitly say that you are allowed to use an elaborated type speci=
fier since an elaborated type specifier is just one particular way of namin=
g a class type. If you have any doubts you can always read the grammar:<br>=
</div><div><br><i>cast-expression:<br></i></div><i>=C2=A0=C2=A0=C2=A0 unary=
-expression<br></i></div><i>=C2=A0=C2=A0=C2=A0 </i><span style=3D"font-fami=
ly:monospace,monospace">(</span><i> type-id </i><span style=3D"font-family:=
monospace,monospace">)</span><i> cast-expression<br><br></i></div>An <i>ela=
borated-type-specifier</i> is a valid <i>type-id</i>.<br></div><div><br><di=
v class=3D"gmail_quote">On Tue, Jan 17, 2017 at 11:03 PM, Ion Todirel <span=
dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-m=
ailto=3D"25e8k5lOCAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'jav=
ascript:';return true;" onclick=3D"this.href=3D'javascript:';re=
turn true;">ionto...@gmail.com</a>></span> wrote:<br><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr">The following code compiles in gcc, clang an=
d vc:<div><br></div><div><div>struct S { S(int) {} };</div><div>void S(int)=
{}</div><div><br></div><div>int main()</div><div>{</div><div>=C2=A0 =C2=A0=
S(1); // ok, calls S(int)</div><div>=C2=A0 =C2=A0 (struct S)(1); // ok, ca=
lls S::S(int) =C2=A0</div><div>=C2=A0 =C2=A0 struct S s(1); // ok, calls S:=
:S(int)</div><div>=C2=A0 =C2=A0 return 0;</div><div>}</div></div><div><br><=
/div><div>I couldn't find a place where creating a temporary using an e=
laborated type specifier is called out in the standard. Specifically the pa=
rans syntax. Is this implied due to some other rule, or is it a bug in the =
compilers that the form is supported? Or should be a bug in the standard if=
not specified?</div><div><br></div><div>Thanks</div><span><font color=3D"#=
888888"><div>-Ion</div></font></span></div><span><font color=3D"#888888">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
25e8k5lOCAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:&=
#39;;return true;" onclick=3D"this.href=3D'javascript:';return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"25e8k5lOCAAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'=
;javascript:';return true;">std-pr...@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D'https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter';return true;" on=
click=3D"this.href=3D'https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter';return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/f7ad5e63-cf22-4d65-<wbr>88cb-=
d39eed5d9b0b%40isocpp.org</a><wbr>.<br>
</font></span></blockquote></div><br><br clear=3D"all"><br>-- <br><div><div=
dir=3D"ltr"><div><div dir=3D"ltr"><font color=3D"#c0c0c0"><i>Brian Bi</i><=
/font><br><div></div><div></div><div></div></div></div></div></div>
</div>
</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-8563-6f9798f9d0a5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-8563-6f9798f9d0a5=
%40isocpp.org</a>.<br />
------=_Part_7553_1973918832.1484764913888--
------=_Part_7552_1888787647.1484764913888--
.
Author: Brian Bi <bbi5291@gmail.com>
Date: Wed, 18 Jan 2017 12:46:15 -0800
Raw View
--001a114627220f5eb405466482e7
Content-Type: text/plain; charset=UTF-8
What do you mean "it's not an expression"? You think that (struct S)(1) is
not an expression? What do you think it is then?
The reason why the parentheses are required is that the grammar says they
are: the *type-id* needs to be enclosed in parentheses. Though S(1) is ok
because it is a *postfix-expression:*
*simple-type-specifier *(* expression-list (opt) *)
*typename-specifier *(* expression-list (opt) *)
*simple-type-specifier braced-init-listtypename-specifier braced-init-list*
Here the parentheses around the type name are not allowed but elaborated
type specifiers are not allowed; only *simple-type-specifiers* and
*typename-specifiers.*
On Wed, Jan 18, 2017 at 10:41 AM, Ion Todirel <iontodirel@gmail.com> wrote:
> it's not an expression though, I specifically meant the temporary, this is
> not allowed for example: "struct S(1)", the parans around "(struct S)" are
> required
>
> On Tuesday, January 17, 2017 at 11:57:33 PM UTC-8, Brian Bi wrote:
>>
>> The standard doesn't have to explicitly say that you are allowed to use
>> an elaborated type specifier since an elaborated type specifier is just one
>> particular way of naming a class type. If you have any doubts you can
>> always read the grammar:
>>
>>
>> *cast-expression:*
>>
>> * unary-expression*
>> (* type-id *)
>>
>> * cast-expression*
>> An *elaborated-type-specifier* is a valid *type-id*.
>>
>> On Tue, Jan 17, 2017 at 11:03 PM, Ion Todirel <ionto...@gmail.com> wrote:
>>
>>> The following code compiles in gcc, clang and vc:
>>>
>>> struct S { S(int) {} };
>>> void S(int) {}
>>>
>>> int main()
>>> {
>>> S(1); // ok, calls S(int)
>>> (struct S)(1); // ok, calls S::S(int)
>>> struct S s(1); // ok, calls S::S(int)
>>> return 0;
>>> }
>>>
>>> I couldn't find a place where creating a temporary using an elaborated
>>> type specifier is called out in the standard. Specifically the parans
>>> syntax. Is this implied due to some other rule, or is it a bug in the
>>> compilers that the form is supported? Or should be a bug in the standard if
>>> not specified?
>>>
>>> Thanks
>>> -Ion
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "ISO C++ Standard - Future Proposals" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to std-proposal...@isocpp.org.
>>> To post to this group, send email to std-pr...@isocpp.org.
>>> To view this discussion on the web visit https://groups.google.com/a/is
>>> ocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-
>>> d39eed5d9b0b%40isocpp.org
>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%40isocpp.org?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>>
>> --
>> *Brian Bi*
>>
> --
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-
> 8563-6f9798f9d0a5%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-8563-6f9798f9d0a5%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
*Brian Bi*
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMmfjbP%2BU1UjAhkCP_dqQydnkuUqnrDwKWLe72EMW9Ze4zPvBA%40mail.gmail.com.
--001a114627220f5eb405466482e7
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><div>What do you mean "it's not an expressio=
n"? You think that (struct S)(1) is not an expression? What do you thi=
nk it is then?<br><br></div>The reason why the parentheses are required is =
that the grammar says they are: the <i>type-id</i> needs to be enclosed in =
parentheses. Though S(1) is ok because it is a <i>postfix-expression:</i><b=
r><br><i>simple-type-specifier </i><span style=3D"font-family:monospace,mon=
ospace">(</span><i> expression-list (opt) </i><span style=3D"font-family:mo=
nospace,monospace">)</span><i><br>typename-specifier </i><span style=3D"fon=
t-family:monospace,monospace">(</span><i> expression-list (opt) </i><span s=
tyle=3D"font-family:monospace,monospace">)</span><i><br>simple-type-specifi=
er braced-init-list<br>typename-specifier braced-init-list</i><br><br></div=
>Here the parentheses around the type name are not allowed but elaborated t=
ype specifiers are not allowed; only <i>simple-type-specifiers</i> and <i>t=
ypename-specifiers.</i><br></div><div class=3D"gmail_extra"><br><div class=
=3D"gmail_quote">On Wed, Jan 18, 2017 at 10:41 AM, Ion Todirel <span dir=3D=
"ltr"><<a href=3D"mailto:iontodirel@gmail.com" target=3D"_blank">iontodi=
rel@gmail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr">it's not an expression though, I specifically meant the tem=
porary, this is not allowed for example: "struct S(1)", the paran=
s around "(struct S)" are required<span class=3D""><br><br>On Tue=
sday, January 17, 2017 at 11:57:33 PM UTC-8, Brian Bi wrote:</span><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1=
px #ccc solid;padding-left:1ex"><span class=3D""><div dir=3D"ltr"><div><div=
><div>The standard doesn't have to explicitly say that you are allowed =
to use an elaborated type specifier since an elaborated type specifier is j=
ust one particular way of naming a class type. If you have any doubts you c=
an always read the grammar:<br></div><div><br><i>cast-expression:<br></i></=
div><i>=C2=A0=C2=A0=C2=A0 unary-expression<br></i></div><i>=C2=A0=C2=A0=C2=
=A0 </i><span style=3D"font-family:monospace,monospace">(</span><i> type-id=
</i><span style=3D"font-family:monospace,monospace">)</span><i> cast-expre=
ssion<br><br></i></div>An <i>elaborated-type-specifier</i> is a valid <i>ty=
pe-id</i>.<br></div></span><div><br><div class=3D"gmail_quote"><span class=
=3D"">On Tue, Jan 17, 2017 at 11:03 PM, Ion Todirel <span dir=3D"ltr"><<=
a rel=3D"nofollow">ionto...@gmail.com</a>></span> wrote:<br></span><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex"><span class=3D""><div dir=3D"ltr">The following c=
ode compiles in gcc, clang and vc:<div><br></div><div><div>struct S { S(int=
) {} };</div><div>void S(int) {}</div><div><br></div><div>int main()</div><=
div>{</div><div>=C2=A0 =C2=A0 S(1); // ok, calls S(int)</div><div>=C2=A0 =
=C2=A0 (struct S)(1); // ok, calls S::S(int) =C2=A0</div><div>=C2=A0 =C2=A0=
struct S s(1); // ok, calls S::S(int)</div><div>=C2=A0 =C2=A0 return 0;</d=
iv><div>}</div></div><div><br></div><div>I couldn't find a place where =
creating a temporary using an elaborated type specifier is called out in th=
e standard. Specifically the parans syntax. Is this implied due to some oth=
er rule, or is it a bug in the compilers that the form is supported? Or sho=
uld be a bug in the standard if not specified?</div><div><br></div><div>Tha=
nks</div><span><font color=3D"#888888"><div>-Ion</div></font></span></div><=
/span><span><font color=3D"#888888"><span class=3D"">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br></span>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<span class=3D""><br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" rel=3D"nofollow" t=
arget=3D"_blank">https://groups.google.com/a/is<wbr>ocpp.org/d/msgid/std-pr=
oposals<wbr>/f7ad5e63-cf22-4d65-88cb-<wbr>d39eed5d9b0b%40isocpp.org</a>.<br=
>
</span></font></span></blockquote></div><br><br clear=3D"all"><br>-- <br><d=
iv><div dir=3D"ltr"><div><div dir=3D"ltr"><font color=3D"#c0c0c0"><i>Brian =
Bi</i></font><br><div></div><div></div><div></div></div></div></div></div>
</div>
</blockquote></div><span class=3D"">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-8563-6f9798f9d0a5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/f38d=
3cd4-9ae1-465f-<wbr>8563-6f9798f9d0a5%40isocpp.org</a><wbr>.<br>
</blockquote></div><br><br clear=3D"all"><br>-- <br><div class=3D"gmail_sig=
nature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=
=3D"ltr"><font color=3D"#c0c0c0"><i>Brian Bi</i></font><br><div></div><div>=
</div><div></div></div></div></div></div>
</div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAMmfjbP%2BU1UjAhkCP_dqQydnkuUqnrDwKW=
Le72EMW9Ze4zPvBA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMmfjbP%2BU1Uj=
AhkCP_dqQydnkuUqnrDwKWLe72EMW9Ze4zPvBA%40mail.gmail.com</a>.<br />
--001a114627220f5eb405466482e7--
.
Author: Ion Todirel <iontodirel@gmail.com>
Date: Wed, 18 Jan 2017 16:38:30 -0800
Raw View
--001a1135b1aca42ab8054667c0c9
Content-Type: text/plain; charset=UTF-8
I was referring to "struct S" not being an expression. I can't find where
it's saying that "type-id needs to be enclosed in parenthesis", I don't
have access to the published standard, I'm using the N4618 draft as the
reference, maybe that doesn't have it?
On Wed, Jan 18, 2017 at 12:46 PM, Brian Bi <bbi5291@gmail.com> wrote:
> What do you mean "it's not an expression"? You think that (struct S)(1) is
> not an expression? What do you think it is then?
>
> The reason why the parentheses are required is that the grammar says they
> are: the *type-id* needs to be enclosed in parentheses. Though S(1) is ok
> because it is a *postfix-expression:*
>
> *simple-type-specifier *(* expression-list (opt) *)
> *typename-specifier *(* expression-list (opt) *)
>
> *simple-type-specifier braced-init-listtypename-specifier braced-init-list*
>
> Here the parentheses around the type name are not allowed but elaborated
> type specifiers are not allowed; only *simple-type-specifiers* and
> *typename-specifiers.*
>
> On Wed, Jan 18, 2017 at 10:41 AM, Ion Todirel <iontodirel@gmail.com>
> wrote:
>
>> it's not an expression though, I specifically meant the temporary, this
>> is not allowed for example: "struct S(1)", the parans around "(struct S)"
>> are required
>>
>> On Tuesday, January 17, 2017 at 11:57:33 PM UTC-8, Brian Bi wrote:
>>>
>>> The standard doesn't have to explicitly say that you are allowed to use
>>> an elaborated type specifier since an elaborated type specifier is just one
>>> particular way of naming a class type. If you have any doubts you can
>>> always read the grammar:
>>>
>>>
>>> *cast-expression:*
>>>
>>> * unary-expression*
>>> (* type-id *)
>>>
>>> * cast-expression*
>>> An *elaborated-type-specifier* is a valid *type-id*.
>>>
>>> On Tue, Jan 17, 2017 at 11:03 PM, Ion Todirel <ionto...@gmail.com>
>>> wrote:
>>>
>>>> The following code compiles in gcc, clang and vc:
>>>>
>>>> struct S { S(int) {} };
>>>> void S(int) {}
>>>>
>>>> int main()
>>>> {
>>>> S(1); // ok, calls S(int)
>>>> (struct S)(1); // ok, calls S::S(int)
>>>> struct S s(1); // ok, calls S::S(int)
>>>> return 0;
>>>> }
>>>>
>>>> I couldn't find a place where creating a temporary using an elaborated
>>>> type specifier is called out in the standard. Specifically the parans
>>>> syntax. Is this implied due to some other rule, or is it a bug in the
>>>> compilers that the form is supported? Or should be a bug in the standard if
>>>> not specified?
>>>>
>>>> Thanks
>>>> -Ion
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "ISO C++ Standard - Future Proposals" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to std-proposal...@isocpp.org.
>>>> To post to this group, send email to std-pr...@isocpp.org.
>>>> To view this discussion on the web visit https://groups.google.com/a/is
>>>> ocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39ee
>>>> d5d9b0b%40isocpp.org
>>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%40isocpp.org?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>>
>>> --
>>> *Brian Bi*
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to std-proposals+unsubscribe@isocpp.org.
>> To post to this group, send email to std-proposals@isocpp.org.
>> To view this discussion on the web visit https://groups.google.com/a/is
>> ocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-8563-
>> 6f9798f9d0a5%40isocpp.org
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-8563-6f9798f9d0a5%40isocpp.org?utm_medium=email&utm_source=footer>
>> .
>>
>
>
>
> --
> *Brian Bi*
>
> --
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/CAMmfjbP%2BU1UjAhkCP_
> dqQydnkuUqnrDwKWLe72EMW9Ze4zPvBA%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMmfjbP%2BU1UjAhkCP_dqQydnkuUqnrDwKWLe72EMW9Ze4zPvBA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmQdeMT7NsbG5bLBHsAL38_05h1c1JzFn0Xwe9M70VzoKGFtg%40mail.gmail.com.
--001a1135b1aca42ab8054667c0c9
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I was referring to "struct S" not being an expre=
ssion. I can't find where it's saying that "type-id needs to b=
e enclosed in parenthesis", I don't have access to the published s=
tandard, I'm using the N4618=C2=A0draft as the reference, maybe that do=
esn't have it?</div><div class=3D"gmail_extra"><br><div class=3D"gmail_=
quote">On Wed, Jan 18, 2017 at 12:46 PM, Brian Bi <span dir=3D"ltr"><<a =
href=3D"mailto:bbi5291@gmail.com" target=3D"_blank">bbi5291@gmail.com</a>&g=
t;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0=
.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><d=
iv>What do you mean "it's not an expression"? You think that =
(struct S)(1) is not an expression? What do you think it is then?<br><br></=
div>The reason why the parentheses are required is that the grammar says th=
ey are: the <i>type-id</i> needs to be enclosed in parentheses. Though S(1)=
is ok because it is a <i>postfix-expression:</i><br><br><i>simple-type-spe=
cifier </i><span style=3D"font-family:monospace,monospace">(</span><i> expr=
ession-list (opt) </i><span style=3D"font-family:monospace,monospace">)</sp=
an><i><br>typename-specifier </i><span style=3D"font-family:monospace,monos=
pace">(</span><i> expression-list (opt) </i><span style=3D"font-family:mono=
space,monospace">)</span><i><br>simple-type-specifier braced-init-list<br>t=
ypename-specifier braced-init-list</i><br><br></div>Here the parentheses ar=
ound the type name are not allowed but elaborated type specifiers are not a=
llowed; only <i>simple-type-specifiers</i> and <i>typename-specifiers.</i><=
br></div><div><div class=3D"h5"><div class=3D"gmail_extra"><br><div class=
=3D"gmail_quote">On Wed, Jan 18, 2017 at 10:41 AM, Ion Todirel <span dir=3D=
"ltr"><<a href=3D"mailto:iontodirel@gmail.com" target=3D"_blank">iontodi=
rel@gmail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr">it's not an expression though, I specifically meant the tem=
porary, this is not allowed for example: "struct S(1)", the paran=
s around "(struct S)" are required<span><br><br>On Tuesday, Janua=
ry 17, 2017 at 11:57:33 PM UTC-8, Brian Bi wrote:</span><blockquote class=
=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><span><div dir=3D"ltr"><div><div><div>The standard d=
oesn't have to explicitly say that you are allowed to use an elaborated=
type specifier since an elaborated type specifier is just one particular w=
ay of naming a class type. If you have any doubts you can always read the g=
rammar:<br></div><div><br><i>cast-expression:<br></i></div><i>=C2=A0=C2=A0=
=C2=A0 unary-expression<br></i></div><i>=C2=A0=C2=A0=C2=A0 </i><span style=
=3D"font-family:monospace,monospace">(</span><i> type-id </i><span style=3D=
"font-family:monospace,monospace">)</span><i> cast-expression<br><br></i></=
div>An <i>elaborated-type-specifier</i> is a valid <i>type-id</i>.<br></div=
></span><div><br><div class=3D"gmail_quote"><span>On Tue, Jan 17, 2017 at 1=
1:03 PM, Ion Todirel <span dir=3D"ltr"><<a rel=3D"nofollow">ionto...@gma=
il.com</a>></span> wrote:<br></span><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span=
><div dir=3D"ltr">The following code compiles in gcc, clang and vc:<div><br=
></div><div><div>struct S { S(int) {} };</div><div>void S(int) {}</div><div=
><br></div><div>int main()</div><div>{</div><div>=C2=A0 =C2=A0 S(1); // ok,=
calls S(int)</div><div>=C2=A0 =C2=A0 (struct S)(1); // ok, calls S::S(int)=
=C2=A0</div><div>=C2=A0 =C2=A0 struct S s(1); // ok, calls S::S(int)</div>=
<div>=C2=A0 =C2=A0 return 0;</div><div>}</div></div><div><br></div><div>I c=
ouldn't find a place where creating a temporary using an elaborated typ=
e specifier is called out in the standard. Specifically the parans syntax. =
Is this implied due to some other rule, or is it a bug in the compilers tha=
t the form is supported? Or should be a bug in the standard if not specifie=
d?</div><div><br></div><div>Thanks</div><span><font color=3D"#888888"><div>=
-Ion</div></font></span></div></span><span><font color=3D"#888888"><span>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br></span>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<span><br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" rel=3D"nofollow" t=
arget=3D"_blank">https://groups.google.com/a/is<wbr>ocpp.org/d/msgid/std-pr=
oposals<wbr>/f7ad5e63-cf22-4d65-88cb-d39ee<wbr>d5d9b0b%40isocpp.org</a>.<br=
>
</span></font></span></blockquote></div><br><br clear=3D"all"><br>-- <br><d=
iv><div dir=3D"ltr"><div><div dir=3D"ltr"><font color=3D"#c0c0c0"><i>Brian =
Bi</i></font><br><div></div><div></div><div></div></div></div></div></div>
</div>
</blockquote></div><span>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isoc<wbr>pp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-8563-6f9798f9d0a5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/is<wbr>ocpp.org/d/msgid/std-proposals<wbr>/f38d=
3cd4-9ae1-465f-8563-<wbr>6f9798f9d0a5%40isocpp.org</a>.<br>
</blockquote></div><br><br clear=3D"all"><br>-- <br><div class=3D"m_6843396=
029948979883gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D=
"ltr"><div><div dir=3D"ltr"><font color=3D"#c0c0c0"><i>Brian Bi</i></font><=
br><div></div><div></div><div></div></div></div></div></div>
</div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></div></div>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAMmfjbP%2BU1UjAhkCP_dqQydnkuUqnrDwKW=
Le72EMW9Ze4zPvBA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r" target=3D"_blank">https://groups.google.com/a/<wbr>isocpp.org/d/msgid/st=
d-<wbr>proposals/CAMmfjbP%<wbr>2BU1UjAhkCP_<wbr>dqQydnkuUqnrDwKWLe72EMW9Ze4=
zPv<wbr>BA%40mail.gmail.com</a>.<br>
</blockquote></div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CALmQdeMT7NsbG5bLBHsAL38_05h1c1JzFn0X=
we9M70VzoKGFtg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmQdeMT7NsbG5bL=
BHsAL38_05h1c1JzFn0Xwe9M70VzoKGFtg%40mail.gmail.com</a>.<br />
--001a1135b1aca42ab8054667c0c9--
.
Author: Brian Bi <bbi5291@gmail.com>
Date: Wed, 18 Jan 2017 16:46:27 -0800
Raw View
--001a113ee5e2158103054667dd4f
Content-Type: text/plain; charset=UTF-8
You can see the grammar in the draft standard here:
http://eel.is/c++draft/expr.cast#2 and here:
http://eel.is/c++draft/expr.post#1
On Wed, Jan 18, 2017 at 4:38 PM, Ion Todirel <iontodirel@gmail.com> wrote:
> I was referring to "struct S" not being an expression. I can't find where
> it's saying that "type-id needs to be enclosed in parenthesis", I don't
> have access to the published standard, I'm using the N4618 draft as the
> reference, maybe that doesn't have it?
>
> On Wed, Jan 18, 2017 at 12:46 PM, Brian Bi <bbi5291@gmail.com> wrote:
>
>> What do you mean "it's not an expression"? You think that (struct S)(1)
>> is not an expression? What do you think it is then?
>>
>> The reason why the parentheses are required is that the grammar says they
>> are: the *type-id* needs to be enclosed in parentheses. Though S(1) is
>> ok because it is a *postfix-expression:*
>>
>> *simple-type-specifier *(* expression-list (opt) *)
>> *typename-specifier *(* expression-list (opt) *)
>>
>> *simple-type-specifier braced-init-listtypename-specifier
>> braced-init-list*
>>
>> Here the parentheses around the type name are not allowed but elaborated
>> type specifiers are not allowed; only *simple-type-specifiers* and
>> *typename-specifiers.*
>>
>> On Wed, Jan 18, 2017 at 10:41 AM, Ion Todirel <iontodirel@gmail.com>
>> wrote:
>>
>>> it's not an expression though, I specifically meant the temporary, this
>>> is not allowed for example: "struct S(1)", the parans around "(struct S)"
>>> are required
>>>
>>> On Tuesday, January 17, 2017 at 11:57:33 PM UTC-8, Brian Bi wrote:
>>>>
>>>> The standard doesn't have to explicitly say that you are allowed to use
>>>> an elaborated type specifier since an elaborated type specifier is just one
>>>> particular way of naming a class type. If you have any doubts you can
>>>> always read the grammar:
>>>>
>>>>
>>>> *cast-expression:*
>>>>
>>>> * unary-expression*
>>>> (* type-id *)
>>>>
>>>> * cast-expression*
>>>> An *elaborated-type-specifier* is a valid *type-id*.
>>>>
>>>> On Tue, Jan 17, 2017 at 11:03 PM, Ion Todirel <ionto...@gmail.com>
>>>> wrote:
>>>>
>>>>> The following code compiles in gcc, clang and vc:
>>>>>
>>>>> struct S { S(int) {} };
>>>>> void S(int) {}
>>>>>
>>>>> int main()
>>>>> {
>>>>> S(1); // ok, calls S(int)
>>>>> (struct S)(1); // ok, calls S::S(int)
>>>>> struct S s(1); // ok, calls S::S(int)
>>>>> return 0;
>>>>> }
>>>>>
>>>>> I couldn't find a place where creating a temporary using an elaborated
>>>>> type specifier is called out in the standard. Specifically the parans
>>>>> syntax. Is this implied due to some other rule, or is it a bug in the
>>>>> compilers that the form is supported? Or should be a bug in the standard if
>>>>> not specified?
>>>>>
>>>>> Thanks
>>>>> -Ion
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "ISO C++ Standard - Future Proposals" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to std-proposal...@isocpp.org.
>>>>> To post to this group, send email to std-pr...@isocpp.org.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals
>>>>> /f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%40isocpp.org
>>>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%40isocpp.org?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Brian Bi*
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "ISO C++ Standard - Future Proposals" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to std-proposals+unsubscribe@isocpp.org.
>>> To post to this group, send email to std-proposals@isocpp.org.
>>> To view this discussion on the web visit https://groups.google.com/a/is
>>> ocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-8563-6f979
>>> 8f9d0a5%40isocpp.org
>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-8563-6f9798f9d0a5%40isocpp.org?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>>
>> --
>> *Brian Bi*
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to std-proposals+unsubscribe@isocpp.org.
>> To post to this group, send email to std-proposals@isocpp.org.
>> To view this discussion on the web visit https://groups.google.com/a/is
>> ocpp.org/d/msgid/std-proposals/CAMmfjbP%2BU1UjAhkCP_dqQydnku
>> UqnrDwKWLe72EMW9Ze4zPvBA%40mail.gmail.com
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMmfjbP%2BU1UjAhkCP_dqQydnkuUqnrDwKWLe72EMW9Ze4zPvBA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/CALmQdeMT7NsbG5bLBHsAL38_
> 05h1c1JzFn0Xwe9M70VzoKGFtg%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmQdeMT7NsbG5bLBHsAL38_05h1c1JzFn0Xwe9M70VzoKGFtg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
*Brian Bi*
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMmfjbPxANXYDfhGzwfB4azO%3Dx0Lbbf-6XF91TrPG6L6_xZXbQ%40mail.gmail.com.
--001a113ee5e2158103054667dd4f
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">You can see the grammar in the draft standard here: <a hre=
f=3D"http://eel.is/c++draft/expr.cast#2">http://eel.is/c++draft/expr.cast#2=
</a> and here: <a href=3D"http://eel.is/c++draft/expr.post#1">http://eel.is=
/c++draft/expr.post#1</a><br></div><div class=3D"gmail_extra"><br><div clas=
s=3D"gmail_quote">On Wed, Jan 18, 2017 at 4:38 PM, Ion Todirel <span dir=3D=
"ltr"><<a href=3D"mailto:iontodirel@gmail.com" target=3D"_blank">iontodi=
rel@gmail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr">I was referring to "struct S" not being an expression=
.. I can't find where it's saying that "type-id needs to be enc=
losed in parenthesis", I don't have access to the published standa=
rd, I'm using the N4618=C2=A0draft as the reference, maybe that doesn&#=
39;t have it?</div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote=
"><div><div class=3D"h5">On Wed, Jan 18, 2017 at 12:46 PM, Brian Bi <span d=
ir=3D"ltr"><<a href=3D"mailto:bbi5291@gmail.com" target=3D"_blank">bbi52=
91@gmail.com</a>></span> wrote:<br></div></div><blockquote class=3D"gmai=
l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left=
:1ex"><div><div class=3D"h5"><div dir=3D"ltr"><div><div>What do you mean &q=
uot;it's not an expression"? You think that (struct S)(1) is not a=
n expression? What do you think it is then?<br><br></div>The reason why the=
parentheses are required is that the grammar says they are: the <i>type-id=
</i> needs to be enclosed in parentheses. Though S(1) is ok because it is a=
<i>postfix-expression:</i><br><br><i>simple-type-specifier </i><span style=
=3D"font-family:monospace,monospace">(</span><i> expression-list (opt) </i>=
<span style=3D"font-family:monospace,monospace">)</span><i><br>typename-spe=
cifier </i><span style=3D"font-family:monospace,monospace">(</span><i> expr=
ession-list (opt) </i><span style=3D"font-family:monospace,monospace">)</sp=
an><i><br>simple-type-specifier braced-init-list<br>typename-specifier brac=
ed-init-list</i><br><br></div>Here the parentheses around the type name are=
not allowed but elaborated type specifiers are not allowed; only <i>simple=
-type-specifiers</i> and <i>typename-specifiers.</i><br></div><div><div cla=
ss=3D"m_-3966626411056961704h5"><div class=3D"gmail_extra"><br><div class=
=3D"gmail_quote">On Wed, Jan 18, 2017 at 10:41 AM, Ion Todirel <span dir=3D=
"ltr"><<a href=3D"mailto:iontodirel@gmail.com" target=3D"_blank">iontodi=
rel@gmail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr">it's not an expression though, I specifically meant the tem=
porary, this is not allowed for example: "struct S(1)", the paran=
s around "(struct S)" are required<span><br><br>On Tuesday, Janua=
ry 17, 2017 at 11:57:33 PM UTC-8, Brian Bi wrote:</span><blockquote class=
=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><span><div dir=3D"ltr"><div><div><div>The standard d=
oesn't have to explicitly say that you are allowed to use an elaborated=
type specifier since an elaborated type specifier is just one particular w=
ay of naming a class type. If you have any doubts you can always read the g=
rammar:<br></div><div><br><i>cast-expression:<br></i></div><i>=C2=A0=C2=A0=
=C2=A0 unary-expression<br></i></div><i>=C2=A0=C2=A0=C2=A0 </i><span style=
=3D"font-family:monospace,monospace">(</span><i> type-id </i><span style=3D=
"font-family:monospace,monospace">)</span><i> cast-expression<br><br></i></=
div>An <i>elaborated-type-specifier</i> is a valid <i>type-id</i>.<br></div=
></span><div><br><div class=3D"gmail_quote"><span>On Tue, Jan 17, 2017 at 1=
1:03 PM, Ion Todirel <span dir=3D"ltr"><<a rel=3D"nofollow">ionto...@gma=
il.com</a>></span> wrote:<br></span><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span=
><div dir=3D"ltr">The following code compiles in gcc, clang and vc:<div><br=
></div><div><div>struct S { S(int) {} };</div><div>void S(int) {}</div><div=
><br></div><div>int main()</div><div>{</div><div>=C2=A0 =C2=A0 S(1); // ok,=
calls S(int)</div><div>=C2=A0 =C2=A0 (struct S)(1); // ok, calls S::S(int)=
=C2=A0</div><div>=C2=A0 =C2=A0 struct S s(1); // ok, calls S::S(int)</div>=
<div>=C2=A0 =C2=A0 return 0;</div><div>}</div></div><div><br></div><div>I c=
ouldn't find a place where creating a temporary using an elaborated typ=
e specifier is called out in the standard. Specifically the parans syntax. =
Is this implied due to some other rule, or is it a bug in the compilers tha=
t the form is supported? Or should be a bug in the standard if not specifie=
d?</div><div><br></div><div>Thanks</div><span><font color=3D"#888888"><div>=
-Ion</div></font></span></div></span><span><font color=3D"#888888"><span>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br></span>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<span><br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f7ad5e63-cf22-4d65-88cb-d39eed5d9b0b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" rel=3D"nofollow" t=
arget=3D"_blank">https://groups.google.com/a/is<wbr>ocpp.org/d/msgid/std-pr=
oposals<wbr>/f7ad5e63-cf22-4d65-88cb-d39ee<wbr>d5d9b0b%40isocpp.org</a>.<br=
>
</span></font></span></blockquote></div><br><br clear=3D"all"><br>-- <br><d=
iv><div dir=3D"ltr"><div><div dir=3D"ltr"><font color=3D"#c0c0c0"><i>Brian =
Bi</i></font><br><div></div><div></div><div></div></div></div></div></div>
</div>
</blockquote></div><span>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isoc<wbr>pp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f38d3cd4-9ae1-465f-8563-6f9798f9d0a5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/is<wbr>ocpp.org/d/msgid/std-proposals<wbr>/f38d=
3cd4-9ae1-465f-8563-6f979<wbr>8f9d0a5%40isocpp.org</a>.<br>
</blockquote></div><br><br clear=3D"all"><br>-- <br><div class=3D"m_-396662=
6411056961704m_6843396029948979883gmail_signature" data-smartmail=3D"gmail_=
signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><font color=3D"#c0c0c0"><=
i>Brian Bi</i></font><br><div></div><div></div><div></div></div></div></div=
></div>
</div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isoc<wbr>pp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></div></div></div>=
</div>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAMmfjbP%2BU1UjAhkCP_dqQydnkuUqnrDwKW=
Le72EMW9Ze4zPvBA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r" target=3D"_blank">https://groups.google.com/a/is<wbr>ocpp.org/d/msgid/st=
d-proposals<wbr>/CAMmfjbP%2BU1UjAhkCP_dqQydnku<wbr>UqnrDwKWLe72EMW9Ze4zPvBA=
%<wbr>40mail.gmail.com</a>.<br>
</blockquote></div><br></div><span class=3D"">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CALmQdeMT7NsbG5bLBHsAL38_05h1c1JzFn0X=
we9M70VzoKGFtg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
target=3D"_blank">https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-=
<wbr>proposals/<wbr>CALmQdeMT7NsbG5bLBHsAL38_<wbr>05h1c1JzFn0Xwe9M70VzoKGFt=
g%<wbr>40mail.gmail.com</a>.<br>
</blockquote></div><br><br clear=3D"all"><br>-- <br><div class=3D"gmail_sig=
nature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=
=3D"ltr"><font color=3D"#c0c0c0"><i>Brian Bi</i></font><br><div></div><div>=
</div><div></div></div></div></div></div>
</div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAMmfjbPxANXYDfhGzwfB4azO%3Dx0Lbbf-6X=
F91TrPG6L6_xZXbQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMmfjbPxANXYDf=
hGzwfB4azO%3Dx0Lbbf-6XF91TrPG6L6_xZXbQ%40mail.gmail.com</a>.<br />
--001a113ee5e2158103054667dd4f--
.