[cfe-commits] r146842 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/SemaCXX/constant-expression.cpp

Abramo Bagnara abramo.bagnara at gmail.com
Sun Dec 18 02:33:40 PST 2011

Il 18/12/2011 03:33, Richard Smith ha scritto:
> Author: rsmith
> Date: Sat Dec 17 20:33:09 2011
> New Revision: 146842
> URL: http://llvm.org/viewvc/llvm-project?rev=146842&view=rev
> Log:
> PR11604: don't allow floating-literal-to-integer casts in ICEs if the (truncated)
> floating literal value does not fit into the destination type. Such casts have
> undefined behavior at translation time; treating them as non-ICE matches the
> behavior of modern gcc versions.

Just curious... do you think that the aim of the standard is to disallow
the last and to allow the second?

enum {a = (int) 2.0f};
enum {b = (int) (2.0f)};
enum {c = (int) -2.0f};

More information about the cfe-commits mailing list