[Bug c++/56292] New: False positive for constexpr arithmetics (-Wconversion)
lcid-fire at gmx dot net
gcc-bugzilla@gcc.gnu.org
Tue Feb 12 08:07:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56292
Bug #: 56292
Summary: False positive for constexpr arithmetics
(-Wconversion)
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: lcid-fire@gmx.net
For the following code one gets 'conversion' diagnostics, while the compiler
should be able to compute, that it is actually fine.
#include <cstdint>
constexpr std::uint8_t func() { return 2; }
std::uint8_t value = func() + 2;
Results in:
warning: conversion to ‘uint8_t {aka unsigned char}’ from ‘int’ may alter its
value [-Wconversion]
Diagnostics works fine if you replace 'func()' with a number.
More information about the Gcc-bugs
mailing list