This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/40944] [C++0x] rejects well-formed code: SFINAE, decltype, function call
- From: "s dot gesemann at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Aug 2009 12:48:22 -0000
- Subject: [Bug c++/40944] [C++0x] rejects well-formed code: SFINAE, decltype, function call
- References: <bug-40944-17257@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from s dot gesemann at gmail dot com 2009-08-16 12:48 -------
This is probably a related (SFINAE<->decltype) problem:
template<typename T>
struct meta {
static T&& m(); // make
static void s(T); // sink
};
// operator()(T&,int) available ?
template<typename T, typename = decltype( meta<T&>::m()(23) )>
int foo(T x) {
x(23);
return 1;
}
int foo(...) {
return 0;
}
int main() {
return foo(42);
}
As far as I can tell it should compile with -std=c++0x and return 0. Instead,
the compiler rejects the code.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40944