Closed Bug 623116 Opened 9 years ago Closed 9 years ago

Add constructor for nsASCIICaseInsensitiveStringComparator (which inherits from nsStringComparator) to placate CLang

Categories

(Core :: Internationalization, defect)

x86_64
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: espindola, Assigned: espindola)

References

Details

Attachments

(1 file)

Attached patch patchSplinter Review
nsASCIICaseInsensitiveStringComparator is missing a user defined constructor, but in nsCSSRuleProcessor.cpp a const variable of this type is defined.

This is not valid c++. For more information see "Default initialization of const variable of a class type requires user-defined default constructor" in http://clang.llvm.org/compatibility.html#c++
Attachment #501232 - Attachment is patch: true
Attachment #501232 - Attachment mime type: application/octet-stream → text/plain
Attachment #501232 - Flags: review?(smontagu)
bugzilla doesn't linkify ++, and your link was poor anyway,

http://clang.llvm.org/compatibility.html#default_init_const

is I believe what you intended to reference.
OS: Mac OS X → Windows 7
The reporter's summary and initial comment were both lame. I'm merely adjusting the summary and providing a better link. I am not passing judgement on the quality of the bug report.

http://clang.llvm.org/compatibility.html#default_init_const
Summary: Missing constructor → Add constructor for nsASCIICaseInsensitiveStringComparator (which inherits from nsStringComparator) to placate CLang
I'm far from a C++ language expert, but does that in fact apply? nsASCIICaseInsensitiveStringComparator is non-POD, since it has a base class.
Sorry for the lameness, but I had to open 13 silly bugs like this and with such an overhead copy and pasting becomes really tempting.

The paragraph in question says:

If no initializer is specified for an object, and the object is of (possibly cv-qualified) non-POD class type (or array thereof), the object shall be default-initialized; if the object is of const-qualified type, the underlying class type shall have a user-declared default constructor. Otherwise, if no initializer is specified for a non-static object, the object and its subobjects, if any, have an indeterminate initial; if the object or any of its subobjects are of const-qualified type, the program is ill-formed.

So i think it applies because it is non-POD.
and it was not on windows
OS: Windows 7 → Mac OS X
Attachment #501232 - Flags: review?(smontagu) → review+
This patch along with the ones in bug #623123 , #623126 , #628371 also fixes compilation with gcc 4.6 , hats off to espindola, thanks!
Assignee: smontagu → respindola
http://hg.mozilla.org/mozilla-central/rev/067fdfe97f0d
Status: NEW → RESOLVED
Closed: 9 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.2
You need to log in before you can comment on or make changes to this bug.