0

(using c++2a, clang 10.0)

im trying to initialize fields in a base struct via .<fieldname>syntax

eg., this i thought would be legal code in c++17

struct
    TOP_t {
        int top;
    };

struct
    SUB_t : public TOP_t {
        int sub;
   };


SUB_t x {
    .top { 1 }, // *err* Field designator 'top' does not refer to any field in type 'SUB_t'
    .sub { 1 } // ok
};

am i right, should this be legal?

mrchance
  • 1,133
  • 8
  • 24

0 Answers0