Boost logo

Boost :

Subject: Re: [boost] [config] request for BOOST_NO_FWD_STD_DECLARATION
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2011-02-16 10:33:39


On 16.02.2011, at 15:49, Mathias Gaunard wrote:

> On 16/02/2011 13:52, Christopher Jefferson wrote:
>>
>> On 16 Feb 2011, at 12:35, Mathias Gaunard wrote:
>>
>>> On 15/02/2011 21:54, Christopher Jefferson wrote:
>>>> libc++ does not allow forward declarations of types for std:: , as it uses inline namespace to allow versioning.
>>>
>>> Is that legal?
>>
>> I think so. I believe it is impossible to tell, except when trying to do forward declarations of C++ standard library types.
>>
>> The question is then if forward declarations of types in std:: are allowed. From 17.6.3.2.1p1 in the current C++0x draft (there is identical text in the c++03 standard):
>>
>> "The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified."
>>
>> While people could read this in various ways, I would say it forbids these kinds of games, although they might work for particular standard libraries.
>
> The standard also gives the reference of what the declarations of the classes of the standard library must be, and all those declarations are in namespace std.

It also contains this in C++0x 17.6.1.1p2:
"It is unspecified whether names declared in a specific namespace are declared directly in that namespace or in an inline namespace inside that namespace."

Sebastian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk