The code generated for metadata.thrift is not compiling in "clang-14 & libstdc++-12.1 & c++20" environment. The version of clang isn't important, but version of libstdc++ and cxx_standard are.
The problem can be seen in the snippet. The copy-ctor of vector<ThriftConstValuePair> inside set_cvmap can't be instantiated before definition of ThriftConstValuePair. And a compiler, IMHO, can make a decision to instantiate it eagerly in instantiation point at the end of ThriftConstValue definition. So, IIYC, the generated code is "ill-formed no diagnostic required".
I don't see a simple solution, but can suggest several hard ones:
Member methods in such "cyclic" cases (or even always) can be declared inside the class, but defined later after definition of all classes.
All classes can be put into some struct X (like last-level namespace), which will enforce standard-compliant compilers postpone instantiation to the end of X definition.
Hello,
fbthrift
team!clang-14 & libstdc++-12.1 & c++20
" environment. The version of clang isn't important, but version oflibstdc++
andcxx_standard
are.copy-ctor
ofvector<ThriftConstValuePair>
insideset_cvmap
can't be instantiated before definition ofThriftConstValuePair
. And a compiler, IMHO, can make a decision to instantiate it eagerly in instantiation point at the end ofThriftConstValue
definition. So, IIYC, the generated code is "ill-formed no diagnostic required".struct X
(like last-level namespace), which will enforce standard-compliant compilers postpone instantiation to the end of X definition.