Closed
Bug 418170
Opened 16 years ago
Closed 16 years ago
gcc-dehydra: templates, incomplete types, and nsTObserverArray.cpp
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: benjamin, Assigned: taras.mozilla)
Details
Attachments
(1 file)
502 bytes,
patch
|
Details | Diff | Splinter Review |
When processing nsTObserverArray.cpp on mozilla trunk using gcc-dehydra: BEGIN: process_class PARAM: c #1={kind:"class", bases:[{isIncomplete:true, kind:"class", name:"nsTArray<E>"}], members:[{name:"nsAutoTArray<E, 0u>::nsA utoTArray()", isFunction:true, isConstructor:true, type:{type:{isIncomplete:true, name:"void"}, parameters:[{isPointer:tr ue, type:#1#}]}, isStatic:true, loc:"/builds/clean-trunk/mozilla/xpcom/glue/nsTArray.h:763:18"}], name:"nsAutoTArray<E, 0 u>"} END: process_class I'm not sure whether process_class is supposed to be called at all for non-instantiated template classes (I thought it wasn't). But nsAutoTArray<E, 0u> is not a complete class... and it's even worse that it's supposedly a complete class with an incomplete base (just can't happen!). I have an explicit check+warning for this case right now, but I'm afraid it is a sign of some deeper problem. I can attach the .ii file if you need, but since it's reproducable with CVS trunk or mozilla-central I figured it probably wasn't necessary.
Comment 1•16 years ago
|
||
I'm looking into this.
Comment 2•16 years ago
|
||
OK, it's caused by a partial specialization (if I've got the C++ terminology right). Dehydra seems to be calling process_class on partial specializations, as if they were instantiations. A reduced test case follows. I'll see if I can figure out a patch. template<typename T, int e> class Array { T a[e]; }; template<typename E> class Array<E, 0> { E *a; };
Comment 3•16 years ago
|
||
Well, here's my attempt at a fix. I added a check for specializations. See cp/cp-tree.h for the def of the macro I used.
Updated•16 years ago
|
Attachment #304361 -
Attachment is patch: true
Attachment #304361 -
Attachment mime type: application/octet-stream → text/plain
Assignee | ||
Comment 4•16 years ago
|
||
Comment on attachment 304361 [details] [diff] [review] Proposed patch >+ int template_status = CLASSTYPE_USE_TEMPLATE(c); >+ if (template_status == 2) return; No need for the extra variable here. Please add your testcase to the patch too.
Comment 5•16 years ago
|
||
Corrections made and fix pushed.
Assignee | ||
Updated•16 years ago
|
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Product: Core → Firefox Build System
Updated•2 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•