This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71487] New: sorry, unimplemented: mangling offset_ref
- From: "lemonedo at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 10 Jun 2016 08:26:11 +0000
- Subject: [Bug c++/71487] New: sorry, unimplemented: mangling offset_ref
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71487
Bug ID: 71487
Summary: sorry, unimplemented: mangling offset_ref
Product: gcc
Version: 5.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lemonedo at gmail dot com
Target Milestone: ---
The following C++ code does not compile with GCC 5.3.1.
#include <iostream>
#include <string>
template<class T> T& declval() { return *static_cast<T*>(0); }
template<class F, class T>
struct PropertyMatcher {
F memfun;
T expected;
PropertyMatcher(F memfun, T expected) : memfun(memfun), expected(expected)
{}
template<class U>
void operator()(U actual) {
std::cout << ((actual.*memfun)() == expected) << std::endl;
}
};
template<class F, class T>
PropertyMatcher<F, T> Property(F memfun, T expected) {
return PropertyMatcher<F, T>(memfun, expected);
}
template<class T>
auto HasLength(T expected) -> decltype(Property(&std::string::size,
declval<T>())) {
return Property(&std::string::size, expected);
}
int main() {
HasLength(3)(std::string("hel"));
}