<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Microsoft extensions allow to access private methods of template base class"
href="https://llvm.org/bugs/show_bug.cgi?id=30601">30601</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Microsoft extensions allow to access private methods of template base class
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>agutowski@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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()</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>