Opened 7 years ago

#11682 new Bugs

fusion::pair not compatible with std::is_default_constructible

Reported by: crmoore@… Owned by: Joel de Guzman
Milestone: To Be Determined Component: fusion
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description

When the Second type of pair is not default constructible, std::is_default_constructible either returns true or fails to compile for fusion::pair.

This is on OSX with apple and macports compilers.

Adding enable_if< is_default_constructible<Second> > to pair's default constructor makes this work as expected.

struct NotDefaultConstructible {
  NotDefaultConstructible(int){};
};

// prints 0
std::cout << std::is_default_constructible< NotDefaultConstructible >::value << std::endl;

using fusion_pair1 = boost::fusion::pair<int, NotDefaultConstructible>;

// should print 0
// fails to compile on clang (xcode 7, 3.4, 3.6, 3.7), gcc 4.9
// prints 1 on gcc 5, clang 3.4
std::cout << std::is_default_constructible< fusion_pair1 >::value << std::endl;

Test and patch attached. Patch is unlikely to meat portability requirements to be applied as-is.

Attachments (2)

test-11681.cpp (604 bytes ) - added by crmoore@… 7 years ago.
Test app
patch1-11681.patch (654 bytes ) - added by crmoore@… 7 years ago.

Download all attachments as: .zip

Change History (2)

by crmoore@…, 7 years ago

Attachment: test-11681.cpp added

Test app

by crmoore@…, 7 years ago

Attachment: patch1-11681.patch added
Note: See TracTickets for help on using tickets.