[cfe-commits] r149286 - in /cfe/trunk: lib/AST/ExprConstant.cpp lib/Sema/SemaOverload.cpp test/CXX/expr/expr.const/p2-0x.cpp

Richard Smith richard at metafoo.co.uk
Mon Jan 30 18:01:05 PST 2012


On Mon, Jan 30, 2012 at 4:29 PM, Eli Friedman <eli.friedman at gmail.com>wrote:

> On Mon, Jan 30, 2012 at 2:27 PM, Richard Smith
> <richard-llvm at metafoo.co.uk> wrote:
> > Author: rsmith
> > Date: Mon Jan 30 16:27:01 2012
> > New Revision: 149286
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=149286&view=rev
> > Log:
> > constexpr: disallow signed integer overflow in integral conversions in
> constant
> > expressions in C++11.
>
> Standard citation?  As far as I can tell, the result of
> (int)0x80000000u is implementation-defined, but it's still a constant
> expression given how we define it.
>

Oops, r149327. This was (incorrectly) factored out of another change which
I'm still questioning... Consider:

  enum E { n = 2 };
  E e = (E)5;

5 is not in the range of values of the enumeration (which is 0..3 by
[dcl.enum]p7), but is clearly in the underlying type. Is this value in the
range of representable values for its type (or is this undefined behavior
by [expr]p4)?

Thanks!
Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120130/49393223/attachment.html>


More information about the cfe-commits mailing list