This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/60594] New: std::function of a type with a declared (but not defined) return type fails to compile
- From: "dblaikie at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 19 Mar 2014 18:49:15 +0000
- Subject: [Bug libstdc++/60594] New: std::function of a type with a declared (but not defined) return type fails to compile
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60594
Bug ID: 60594
Summary: std::function of a type with a declared (but not
defined) return type fails to compile
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: dblaikie at gmail dot com
CC: chandlerc at gmail dot com
#include <functional>
#include <type_traits>
struct bar;
#if BUG1
struct foo { std::function<bar ()> f; };
#elif BUG2
int i = std::is_copy_constructible<std::function<bar()>>::value;
#else
std::function<bar ()> b;
#endif
struct bar { };
int main() {
std::function<bar ()> g([] { return bar(); });
}
Clang rejects both BUG1 and BUG2.
GCC ToT (20140219) rejects BUG2.
(I believe the Clang rejection of BUG1 is erroneous and will file a bug for
that)
libc++ with Clang compiles successfully in all 3 variants.
It looks like, somehow, instantiating the declaration of the std::function copy
constructor relies on the completeness of 'bar'.