This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/56292] New: False positive for constexpr arithmetics (-Wconversion)
- From: "lcid-fire at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 12 Feb 2013 08:07:33 +0000
- Subject: [Bug c++/56292] New: False positive for constexpr arithmetics (-Wconversion)
- Auto-submitted: auto-generated
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.