Closed
Bug 681036
Opened 13 years ago
Closed 13 years ago
Fix c++0x initializer list error found by clang
Categories
(Core Graveyard :: Plug-ins, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla9
People
(Reporter: espindola, Assigned: espindola)
Details
Attachments
(1 file)
647 bytes,
patch
|
karlt
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Updated•13 years ago
|
Attachment #554946 -
Flags: review?(karlt)
Assignee | ||
Comment 1•13 years ago
|
||
in c++ one cannot use an unsigned int in an initalizer list position that wants an int. Unfortunately we cannot change the type of the variables because XGetGeometry expects unsigned pointers.
Comment 2•13 years ago
|
||
Is this new to c++0x? Are you able to quote the relevant sentences in the spec, please? Surely we can do unsigned int a = 1; signed int b = a; In WG21/N1043, "initializer: = initializer-clause ( expression-list ) initializer-clause: assignment-expression { initializer-list ,opt } { } initializer-list: initializer-clause initializer-list , initializer-clause" so initializer-lists are just a series of initializer-clauses. and "All implicit type conversions (4) are considered when initializing the aggregate member with an initializer from an initializer-list." Is there a backward-incompatible change proposed to make initializer lists different, or do I misunderstand or miss something?
Assignee | ||
Comment 3•13 years ago
|
||
It is new, yes. Take a look at [dcl.init.list]. In particular: "If a narrowing conversion (see below) is required to convert any of the arguments, the program is ill-formed." and "A narrowing conversion is an implicit conversion... from an integer type or unscoped enumeration type to an integer type that cannot represent all the values of the original type, except where the source is a constant expression..."
Comment 4•13 years ago
|
||
Comment on attachment 554946 [details] [diff] [review] add casts to gint Thanks for filling me in on the details.
Attachment #554946 -
Flags: review?(karlt) → review+
Comment 5•13 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/7099a6d4c871
Assignee: nobody → respindola
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
Version: unspecified → Trunk
Updated•2 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•