Opened 8 years ago

Closed 8 years ago

#10783 closed Bugs (wontfix)

BOOST_DELETED_FUNCTION must stay on the public section

Reported by: viboes Owned by: John Maddock
Milestone: To Be Determined Component: config
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

The definition of this macro on a public section show a bug

#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
#   define BOOST_DELETED_FUNCTION(fun) fun = delete;
#else
#   define BOOST_DELETED_FUNCTION(fun) private: fun;
#endif

This should be

#   define BOOST_DELETED_FUNCTION(fun) private: fun; public:

Change History (1)

comment:1 by John Maddock, 8 years ago

Resolution: wontfix
Status: newclosed

The behavior you see is what's documented, specifically the docs say: "Since the macro may change the access mode, it is recommended to use this macro at the end of the class definition" and then go on to give an example that shows the access mode may be changed to private by this macro. If you need different behavior, I suggest you use BOOST_NO_CXX11_DELETED_FUNCTIONS in a #if...#else block.

Note: See TracTickets for help on using tickets.