On Thu, Jan 19, 2017 at 4:37 AM, Malcolm Parsons <malcolm.pars...@gmail.com> wrote: > On 19 January 2017 at 03:47, Aaron Ballman <aaron.ball...@gmail.com> wrote: >> It is not used in an unevaluated context -- that is a bug. > > It is an evaluated expression, but is it odr-used? > > C++14 [basic.def.odr] p3: > > A variable x whose name appears as a potentially-evaluated expression > ex is odr-used by ex unless applying the lvalue-to-rvalue conversion > (4.1) to x yields a constant expression (5.20) that does not invoke > any nontrivial functions and, if x is an object, ex is an element of > the set of potential results of an expression e, where either the > lvalue-to-rvalue conversion (4.1) is applied to e, or e is a > discarded-value expression (Clause 5). ... > > 5.20 [expr.const] p3: > > An integral constant expression is an expression of integral or > unscoped enumeration type, implicitly converted to a prvalue, where > the converted expression is a core constant expression. [ Note: Such > expressions may be used as array bounds (8.3.4, 5.3.4), as bit-field > lengths (9.6), as enumerator initializers if the underlying type is > not fixed (7.2), and as alignments (7.6.2). — end note ] > > I read that as kDelta is not odr-used. > > GCC and ICC don't require kDelta to be captured either.
You are correct, it is not an odr use. MSVC is wrong to require the capture. ~Aaron > > -- > Malcolm Parsons _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits