Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

nested namespaces = ODR undefined behaviour

24 views
Skip to first unread message

Mr Flibble

unread,
Feb 3, 2023, 8:06:38 AM2/3/23
to
I forgot how easy it was to invoke C++ ODR-based undefined behaviour when
using nested namespaces! :o

header file #1 :-

namespace parent
{
class foo
{
};
}

header file #2 :-

namespace parent::child
{
class foo
{
};
}

header file #3 :-

namepsace parent::child
{
class bar
{
foo m; // which foo this is depends on header file
inclusion for this translation unit! :o
};
}

/Flibble

Bonita Montero

unread,
Feb 3, 2023, 1:14:25 PM2/3/23
to
And what's your practical problem with that ?
0 new messages