[llvm-bugs] [Bug 30601] New: Microsoft extensions allow to access private methods of template base class
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 3 13:26:54 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=30601
Bug ID: 30601
Summary: Microsoft extensions allow to access private methods
of template base class
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: agutowski at google.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
The following code shouldn't compile (method "f" is private).
$ cat test.cpp
#include <stdio.h>
template<class T>
class Base {
void f() { printf("private Base::f()\n"); }
};
template<class T>
struct Container : Base<T> {
void g() { f(); }
};
int main() {
Container<char> c;
c.g();
return 0;
}
$ clang test.cpp -o test.exe
test.cpp:10:14: warning: use of identifier 'f' found via unqualified lookup
into dependent bases of class templates is a Microsoft extension
[-Wmicrosoft-template]
void g() { f(); }
^
this->
test.cpp:15:5: note: in instantiation of member function 'Container<char>::g'
requested here
c.g();
^
test.cpp:5:8: note: must qualify identifier to find this declaration in
dependent base class
void f() { printf("private Base::f()\n"); }
^
1 warning generated.
$ test.exe
private Base::f()
--
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/20161003/f5550607/attachment.html>
More information about the llvm-bugs
mailing list