<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 --- - accessing private field from public typedef is an error"
href="https://llvm.org/bugs/show_bug.cgi?id=27225">27225</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>accessing private field from public typedef is an error
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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++14
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tower120@gmail.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>The following code doesn't compiles in clang:
<a href="http://coliru.stacked-crooked.com/a/1c88b33600d369f6">http://coliru.stacked-crooked.com/a/1c88b33600d369f6</a>
template<class R, class T1, class T2 = void>
class GenericArity {
std::integral_constant<int, 1> static get(function<R(T1)>){ return {}; }
std::integral_constant<int, 2> static get(function<R(T1, T2)>){ return {};
}
public:
template<class Fn>
using Arity = decltype(get(declval<Fn>()));
template<class Fn>
auto static arity(Fn&&){
return Arity<Fn>{};
}
};
With the following errors:
main.cpp:17:28: error: 'get' is a private member of 'GenericArity<void,
std::__cxx11::basic_string<char>, int>'
using Arity = decltype(get(declval<Fn>()));
^~~
main.cpp:46:60: note: in instantiation of template type alias 'Arity' requested
here
using Arity = GenericArity<void, string, int>::Arity<Fn>;
^
main.cpp:13:43: note: implicitly declared private here
std::integral_constant<int, 2> static get(function<R(T1, T2)>){ return {};
}
^
1 error generated.
P.S. related to <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Access to a public template alias declaration that refers to friend's private nested type is not allowed."
href="show_bug.cgi?id=25334">https://llvm.org/bugs/show_bug.cgi?id=25334</a></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>