forked from microsoft/bond
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make reflection.h types C++20 compatible.
As of C++20, it is malformed to have an unnamed class used in typedef with a base class. In the generated reflection code for a struct, we were using the following construct to create a reflectable entry for each field in a struct. ``` struct var { typedef struct /* no name */ : ::bond::reflection::FieldTemplate<...> {} field_name; } ``` Now, instead of using an unnamed class, we generate a named class and refer to that: ``` struct var { typedef struct field_name_type : ::bond::reflection::FieldTemplate<...> {} field_name; } ``` Since the "field_name_type" struct now has a name in the `var` struct, it may conflict with user-defined field names in the struct. (E.g., if there is another field with the name "field_name_type") To avoid this problem, we ensure that the generated type name is unique. This means that the name of the type may change as fields are add/removed from structs. Only the member for each field in the `var` struct is part of the interface, not the name of the type providing its implementation, so we're free to change the names of these types now and at any time in the future. See also, [C++ proposal P1766R1][1], which make the code we had malformed. Fixes microsoft#1027 [1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1766r1.html
- Loading branch information
1 parent
802438e
commit f1cb707
Showing
98 changed files
with
2,630 additions
and
1,482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.