C++ Logo

std-proposals

Advanced search

Re: [std-proposals] PROPOSAL: reintroduce tag namespace

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Mon, 21 Sep 2026 09:41:57 +0100
On Mon, 21 Sept 2026 at 09:32, Simon Schröder <dr.simon.schroeder_at_[hidden]>
wrote:

> On Mon, Sep 21, 2026 at 10:21 AM Jonathan Wakely via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>>
>> If you get collisions, it means you have something like struct X and enum
>> X, which is stupid. Pick better names.
>>
> From a quick read-up: struct, union, and enum share a single namespace.
> So, struct X and enum X are not allowed in C.
>

Ah yes.

You can get conflicts by using the same name for functions and types:
struct X {};
void X() { }
int main() { X(); }

But (1) this is stupid, don't do it, and (2) the rules are clear that this
disambiguates in favour of the function (for C compatibility) and if you
need to refer to the type, you can still use 'struct X' to do so.

Requiring the struct tag in all programs, rather than just in stupid ones
with ambiguous names, would not be an improvement. It would only benefit
stupid code.



>
> Though, I get the feeling that Liam guy is trolling us. He should just be
> using C if he thinks all these features are superior.
>

Yes, I was thinking the same thing.

Received on 2026-09-21 08:42:14