<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 --- - Incorrect instantiation on code with forward declaration of internal class template by clang 3.8"
href="https://llvm.org/bugs/show_bug.cgi?id=27317">27317</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect instantiation on code with forward declaration of internal class template by clang 3.8
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</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>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>predelnik@gmail.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>I haven't exactly checked it with the standard but the following example
compiles with clang prior to 3.7, all gcc at least since 4.8, msvc 2015.
With clang 3.8 it fails with:
main.cpp:6:30: error: no type named 'NOT_EXISTING_CLASS_NAME' in
'some_spec<int>'
using ttt = typename Spec::NOT_EXISTING_CLASS_NAME;
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Could be fixed with removing
template <class RealType>
friend struct internal_class_template;
or moving internal_class_template definition higher.
This is minimized example from my actual code, so this friend declaration may
not look very rational.
#include <type_traits>
template <class Spec, typename = void>
struct C
{
using ttt = typename Spec::NOT_EXISTING_CLASS_NAME;
};
template <class Spec>
struct C<Spec, typename std::enable_if<std::is_object<typename Spec::template
internal_class_template<int>>::value>::type>
{
};
template <typename FuncType>
struct some_spec
{
template <class RealType>
struct internal_class_template;
struct internal_class
{
private:
template <class RealType>
friend struct internal_class_template;
};
template <class RealType>
struct internal_class_template
{
};
};
int main ()
{
C<some_spec<int>> xx {}; (void) (xx);
}</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>