Opened 11 years ago

Closed 9 years ago

#5761 closed Bugs (invalid)

warning im MPL source

Reported by: anonymous Owned by: Aleksey Gurtovoy
Milestone: To Be Determined Component: mpl
Version: Boost 1.47.0 Severity: Cosmetic
Keywords: Cc:

Description

I get warning in Visual C++ 10, 32 bit mode (strangely, 64 bit mode is warning free):

p:\app\3pp\boost\mpl\print.hpp(51): warning C4308: negative integral constant converted to unsigned type

It is line:

enum { n = sizeof(T) + -1 };

Changing it into:

enum { n = sizeof(T) - 1 };

got rid the warning.

Attachments (1)

print.patch (350 bytes ) - added by Alexander Lobov <alexanderlobov@…> 11 years ago.
Patch for trunk svn version

Download all attachments as: .zip

Change History (5)

by Alexander Lobov <alexanderlobov@…>, 11 years ago

Attachment: print.patch added

Patch for trunk svn version

comment:1 by Alexander Lobov <alexanderlobov@…>, 11 years ago

Why not

enum { n = sizeof(T) + 1 };

?

I've attached patch for this version.

comment:2 by surfersparadise85-sonstiges@…, 10 years ago

Why was this not committed to the base? I still get the same error with boost 1.53 unless I change the line as denoted above.

comment:3 by anonymous, 9 years ago

Just encountered this in 1.54 why not fixed yet ?

comment:4 by Steven Watanabe, 9 years ago

Resolution: invalid
Status: newclosed

This is not a bug. mpl::print is supposed to generate a warning. Check the template instantiation backtrace to find the reason for the warning.

Note: See TracTickets for help on using tickets.