C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] cv-qualified anonymous types and member access expressions

From: Peter Sommerlad (C++) <"Peter>
Date: Thu, 5 May 2022 17:34:58 +0200
Excuse my lay person understanding, but IMHO the code below should not
compile, because there is never a data member defined within my_foo that
will hold an object of the anonymous struct. So this is just a
declaration of a struct without any possible uses.

Aaron Ballman via Liaison wrote on 05.05.22 15:01:
> struct foo {
> const struct {
> int bar;
> };
> } my_foo;
>
> void baz(void) {
> my_foo.bar = 42; // ???
> }

Peter.
-- 
Peter Sommerlad
Better Software: Consulting, Training, Reviews
Modern, Safe & Agile C++
peter.cpp_at_[hidden]
+41 79 432 23 32

Received on 2022-05-05 15:34:59