[llvm-bugs] [Bug 38202] New: inaccessible types allowed as template argument in nested-name-specifier

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 17 18:28:27 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38202

            Bug ID: 38202
           Summary: inaccessible types allowed as template argument in
                    nested-name-specifier
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The code is as follow:

template<class T>
struct list
{
 struct nested { };
};


class F
{
 struct R { };
 class Q
 {
 friend void f(const Q &q) { list<R>::nested n; }
 };
};

clang++ accepts it, but g++ rejects it:

error: 'struct F::R' is private within this context
  friend void f(const Q &q) { list<R>::nested n; }
                                   ^
code1.c.cpp:10:9: note: declared private here
  struct R { };
         ^

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180718/b6c01c03/attachment-0001.html>


More information about the llvm-bugs mailing list