<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 --- - Error when a template-and-non-template-derived-class uses a nested type it inherits from its non-template-base-class"
href="https://llvm.org/bugs/show_bug.cgi?id=25645">25645</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Error when a template-and-non-template-derived-class uses a nested type it inherits from its non-template-base-class
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sugak@fb.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>```
% cat 1.cpp
class Base1 {
public:
typedef int base_int;
};
template <typename T>
class Base2 {};
template<typename T>
class A : public Base1, public Base2<T> {
public:
base_int f();
};
template<typename T>
typename A<T>::base_int A<T>::f() {
return 42;
}
int main() {
A<int> a;
return a.f();
}
% clang++ 1.cpp
1.cpp:16:31: error: return type of out-of-line definition of 'A::f' differs
from that in the declaration
typename A<T>::base_int A<T>::f() {
~~~~~~~~~~~~~~~~~~~~~~~ ^
1.cpp:12:12: note: previous declaration is here
base_int f();
~~~~~~~~ ^
1 error generated.
% clang++ --version
clang version 3.8.0 (trunk 251726)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```
Here `base_int` in A<T> comes from `Base1`, which is not a template, and
according to look up rules compiler should look in this nondependent base class
for base_int. When A<T> inherits only Base1, there is no error.
Works with gcc 4.9.2</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>