http://llvm.org/bugs/show_bug.cgi?id=19643

Richard Smith <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |INVALID

--- Comment #1 from Richard Smith <[email protected]> ---
Sorry, that's not correct.

We have the expression A::a[0]. Let's walk through 3.2/3:

"A variable x [A::a] whose name appears as a potentially-evaluated expression
ex [the id-expression A::a, check] is odr-used unless

  applying the lvalue-to-rvalue conversion to x yields a constant expression
[it does]
  that does not invoke any non-trivial functions [it does not] and,
  if x is an object [it is],
    ex is an element of the set of potential results of an expression e, where
either the lvalue-to-rvalue conversion is applied to e, or e is a
discarded-value expression."

So: what possible values of 'e' are there? The set of potential results of an
expression is a set of subexpressions of the expression, so we only need to
consider expressions of which 'ex' is a subexpression. Those are:

  A::a
  A::a[0]

Of these, the lvalue-to-rvalue conversion is *not* applied immediately to A::a,
so we only consider A::a[0]. Per 3.2/2, the set of potential results of A::a[0]
is empty, so A::a is odr-used by this expression.


Now, you could argue that we first rewrite A::a[0] to *(A::a + 0). But that
changes nothing: the possible values of e are then

  A::a
  A::a + 0
  (A::a + 0)
  *(A::a + 0)

Of these, only the fourth has an lvalue-to-rvalue conversion applied to it, and
again, 3.2/2 says that the set of potential results of *(A::a + 0) is empty.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to