[LLVMbugs] [Bug 6825] New: Missing access control check for injected-class-names used as template-names

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 12 15:48:34 PDT 2010


           Summary: Missing access control check for injected-class-names
                    used as template-names
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dgregor at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

We aren't performing access control for injected-class-names that are used as
template names, e.g.,

terfin:clang dgregor$ cat t3.C
template <class T> struct Base { }; 

template<typename T> class Between : private Base<T> { };

template <class T> struct Derived : private Between<int>, private Between<char>
  Base<double> d;

Derived<double> dd;
terfin:clang dgregor$ clang++ -fsyntax-only t3.C
terfin:clang dgregor$ eccp -A t3.C
"t3.C", line 6: error: type "Base<T>::Base [with T=int]" (declared at line 1)
          is inaccessible
    Base<double> d;
          detected during instantiation of class "Derived<T> [with T=double]"
                    at line 9

1 error detected in the compilation of "t3.C".

The solution is not trivial, because we are performing some ambiguity
resolution (per C++ [temp.local]p4) when the injected-class-names are mapped to
class templates, so we will need to hold on to all of the paths to each of the
injected-class-names; some of those paths may not be accessible while others

GCC doesn't diagnose this example, nor does EDG in non-strict mode, so it's not

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