[LLVMbugs] [Bug 7267] New: Using private types should be allowed as template parametter for explicit instantiation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 31 03:18:12 PDT 2010


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

           Summary: Using private types should be allowed as template
                    parametter for explicit instantiation
           Product: clang
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ogoffart at kde.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


class Foo { class Bar1 {}; class Bar2{}; };
template<class T> struct Test {};
template struct Test<Foo::Bar1>; //#1 explicit instantiation
template<> struct Test<Foo::Bar2> {}; //#2 template specialization

/*
test.cpp:4:27: error: 'Bar1' is a private member of 'Foo'
template struct Test<Foo::Bar1>; //#1 explicit instantiation
                          ^
test.cpp:5:29: error: 'Bar2' is a private member of 'Foo'                       
template<> struct Test<Foo::Bar2> {}; //#2 template specialization
                            ^
*/


GCC compiles this code fine.

According to the standard: 14.7.2 [temp.explicit] ยง8: "The usual access
checking rules do not apply to names used to specify explicit instantiations.
[Note: In particular, the template arguments and names used in the function
declarator (including parameter types, return types and exception
specifications) may be private types or objects which would normally not be
accessible and the template may be a member template or member function which
would not normally be accessible.]"

This seems to cover case #1.
I'm mostly interested in case #2, which cause compilation failure in Qt
(Linguist)
even if I have not found an explicit say that this should be allowed.

-- 
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