r180603 - C++1y: support simple variable assignments in constexpr functions.

Hans Wennborg hans at chromium.org
Mon May 20 06:59:42 PDT 2013


Hi Richard,

On Fri, Apr 26, 2013 at 3:36 PM, Richard Smith
<richard-llvm at metafoo.co.uk> wrote:
> Author: rsmith
> Date: Fri Apr 26 09:36:30 2013
> New Revision: 180603
>
> URL: http://llvm.org/viewvc/llvm-project?rev=180603&view=rev
> Log:
> C++1y: support simple variable assignments in constexpr functions.

This seems to have caused -Winteger-overflow to become much more aggressive.

I don't know what in your code causes this, but I bisected it down to
this revision.

The following code didn't use to warn, but now does (only in C++11 mode though):

#include <time.h>
#include <limits>

void f() {
  long long x;
  x = std::numeric_limits<time_t>::min() * 1000;
}

/tmp/a.cc:6:42: warning: overflow in expression; result is 0 with type
'long' [-Winteger-overflow]
  x = std::numeric_limits<time_t>::min() * 1000;
                                         ^

This is causing problems in Chromium where we have such code, but we
know we won't hit it on platforms where time_t is 64-bit.

Was the warning behaviour change intentional?

Thanks,
Hans



More information about the cfe-commits mailing list