This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/66672] std::is_same wrong result for captured reference value inside a lambda


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

Lukas <deaeod at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |deaeod at gmail dot com

--- Comment #2 from Lukas <deaeod at gmail dot com> ---
I think gcc's result of 10 is correct, and i believe every other compiler is
wrong.

Consider the following passages:

http://eel.is/c++draft/expr.prim.lambda#capture-11.sentence-3
    -- "An id-expression that is not an odr-use refers to the original entity,
never to a member of the closure type."
http://eel.is/c++draft/basic.def.odr#def:potentially_evaluated
    -- "An expression is potentially evaluated unless it is an unevaluated
operand or a subexpression thereof."
http://eel.is/c++draft/basic.def.odr#def:odr-used
    -- "A variable x whose name appears as a potentially-evaluated expression
ex is odr-used by ex unless [...]"
http://eel.is/c++draft/dcl.type.simple#4.sentence-3
    -- "The operand of the decltype specifier is an unevaluated operand."

Combining (1) and (3) means that variable names refer to the original entity,
not the member of the closure, unless that variable name appears in a
potentially evaluated expression.
(2) and (4) combined say that the operand of decltype is not a potentially
evaluated expression.

Thus, variable names inside a decltype expression always refer to the outside
entities.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]