[LLVMbugs] [Bug 8222] New: Mis-compilaton: Failure to find inner template class partial specialization of outer derived template's base class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 24 17:03:09 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8222

           Summary: Mis-compilaton: Failure to find inner template class
                    partial specialization of outer derived template's
                    base class
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: peter.goodman at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=5526)
 --> (http://llvm.org/bugs/attachment.cgi?id=5526)
Test case for reproducing both errors.

== Foreword ==
This is a mis-compilation bug. Unfortunately, and against the principles, this
is two bugs in one--to report the second, I would implicitly need to report the
first, which would be redundant.

== Description ==
Clang++ fails to find the inner template class partial specialization of the
inner class's outer class's base type's inner template (mouthful, I know),
unless a non-template derived type is present, in which case it (for some
reason) chooses the non-template base type's inner class partial
specialization.

The attached .cpp files contains three top-level classes: Base,
DerivedTemplate, and DerivedClass. DerivedClass is not used, and only exists if
the "HIDE_OTHER_ERROR" macro is left undefined. 

When the macro is undefined, Clang++ chooses DerivedClass::Inner's partial
specialization instead of DerivedTemplate::Inner's, even though
DerivedTemplate::Inner is explicitly used.

When the macro is defined, Clang++ ignores DerivedTemplate::Inner's partial
specialization of Base::Inner and chooses Base::Inner, even though
DerivedTemplate::Inner is explicitly used.

== Expected output ==
The expected output of the program is 1. 
If "HIDE_OTHER_ERROR" is not defined, then the output is 2. 
If "HIDE_OTHER_ERROR" is defined, then the output is 0.

== How to test: ==
clang++ clang-tpl-bug.cpp
./a.out

clang++ -DHIDE_ERROR clang-tpl-bug.cpp
./a.out

== Tested on: ==
clang version 2.0 (trunk 105388)
Target: x86_64-apple-darwin10
Thread model: posix

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list