[cfe-dev] Interest in a -Wusing-namespace-in-headers?
Douglas Gregor
dgregor at apple.com
Wed Mar 16 15:56:12 PDT 2011
On Mar 16, 2011, at 3:54 PM, Daniel James wrote:
> On 16 March 2011 22:33, Douglas Gregor <dgregor at apple.com> wrote:
>>
>> On Mar 16, 2011, at 3:19 PM, Elliot Glaysher (Chromium) wrote:
>>
>>> Attached is a in-progress patch for a -Wusing-namespace-in-headers.
>>> I'm not sure if this is something people would be interested in. If
>>> there is, I'll continue working on this.
>>
>> Seems like a reasonable opt-in warning. Are there other constructs that we should warn about in headers? If so, should they be grouped under the same warning flag?
>
> IMO it should only warn in the global namespace. Importing into a
> namespace or function is valid, and often essential. For example,
> libstdc++ uses it to avoid ABI issues and boost uses it for functions
> that should be in the 'std' namespace, but aren't on some platforms.
IIRC, libstdc++ does it with "strong using" directives (which Clang doesn't support).
Boost, I assume, only does this for using declarations; that's not what the patch is about.
- Doug
More information about the cfe-dev
mailing list