[llvm-bugs] [Bug 27225] New: accessing private field from public typedef is an error
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Apr 5 13:03:45 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27225
Bug ID: 27225
Summary: accessing private field from public typedef is an
error
Product: clang
Version: 3.8
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++14
Assignee: unassignedclangbugs at nondot.org
Reporter: tower120 at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
The following code doesn't compiles in clang:
http://coliru.stacked-crooked.com/a/1c88b33600d369f6
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 https://llvm.org/bugs/show_bug.cgi?id=25334
--
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/20160405/ecd1852c/attachment.html>
More information about the llvm-bugs
mailing list