Re: sizeof
Russell Shaw <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
On 10/5/22 5:22 pm, Andreas Schwab wrote: > On Mai 10 2022, Russell Shaw wrote: > >>> Andreas Schwab wrote: >>> On Mai 09 2022, Russell Shaw wrote: >>> >>>> sizeof(int()) should transform to sizeof(int (*)()) according to the C++20 >>>> standard. >>> >>> No, see [expr.sizeof] #3. >> >> What does "[expr.sizeof] #3" refer to ? > > Paragrph #3 in section [expr.sizeof]. > > "The lvalue-to-rvalue (7.3.1), array-to-pointer (7.3.2), and > function-to-pointer (7.3.3) standard conversions are not applied to > the operand of sizeof." "Standard conversions" are only applied to expressions, not type-id (which is an abstract declarator syntax). 7.6.2.5 Sizeof [expr.sizeof] 3) only applies to the first case "sizeof unary-expression", not the second "sizeof ( type-id )". unary-expression : ... sizeof unary-expression sizeof ( type-id ) ************** 7.6.2.5 Sizeof [expr.sizeof] 3) The lvalue-to-rvalue (7.3.2), array-to-pointer (7.3.3), and function-to-pointer (7.3.4) standard conversions are not applied to the operand of sizeof. If the operand is a prvalue, the temporary materialization conversion (7.3.5) is applied. ************** 7.3 Standard conversions [conv] 7.3.1 General [conv.general] A standard conversion sequence will be applied to an expression if necessary to convert it to a required destination type. ************** I don't seem to get all replies on the gdb list so i'm including your email in case you don't get all replies either. I have to check the gdb web page archive.