This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/60594] New: std::function of a type with a declared (but not defined) return type fails to compile


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'.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]