-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] public
non-this
data member has no effect
#336
Comments
If the position of a non- struct cpp2_a_for_z {
x a;
};
class z : public cpp2_a_for_z // ... |
I noticed that
class z: private cpp2::store_as_base<"a",x>, public y { |
[Updated] Thanks!
Hmm, you may have something there. I thought of several ways to implement this, but didn't think of that one -- thank you. [ETA] On second thought, I wonder if I would then have to echo the constructors the same way again, and that would lead to a lot more generated code. For now, perhaps simpler is to disallow non-private data members before base types... that should be a weird combination.
No, that one is just because my current experiment is to require that all base types are public, so |
How about using an aggregate base class that holds a
|
Replace `store_as_base` with generated aggregate bases - better fix for #336, thanks @JohelEGP for the suggestion! This way we also don't need to obfuscate the name anywhere beyond the constructor(s), as the right member object name just enters the class's scope If the user didn't write a constructor, provide a default constructor If the user didn't write a 'that' constructor, suppress Cpp1's compiler-generated copying and assignment Clean up emission of the just-mentioned generated/=deleted constructors, more naturally line up inside the class body following the indentation for other members that the original source code uses Rename file `load.h` to `io.h` (`file.h` was another candidate), just because it has been bothering me for a year now that except for that one file all the headers were in natural alphabetical order by compilation phase... as of this commit we now have them all in alpha order and phase order: common.h -> io.h -> lex.h -> parse.h -> [*] -> sema.h -> cppfront.h [*] coming next here: reflect.h, which will also be in both alpha order and compilation order Guard `out.construct` with `if constexpr` in case the type is not copy assignable and that path is never requested Rename `cpp2::error` to `cpp2::error_entry` to quiet a new(? why?) GCC message about shadowing the former name with `parser::error`... I get why the warning is there, but this is a slightly annoying warning to have to satisfy just to compile high-warning-clean on GCC... oh well Change semantics of emitting `.h2` files: In `-p` pure mode do the existing split of phases 0 and 1 into `.h` and phase 2 into a separate `.hpp`, but in mixed mode put all phases into the `.h`
Thanks @JohelEGP for that aggregate base suggestion, that's nicer -- done in the commit I just pushed |
Replace `store_as_base` with generated aggregate bases - better fix for hsutter#336, thanks @JohelEGP for the suggestion! This way we also don't need to obfuscate the name anywhere beyond the constructor(s), as the right member object name just enters the class's scope If the user didn't write a constructor, provide a default constructor If the user didn't write a 'that' constructor, suppress Cpp1's compiler-generated copying and assignment Clean up emission of the just-mentioned generated/=deleted constructors, more naturally line up inside the class body following the indentation for other members that the original source code uses Rename file `load.h` to `io.h` (`file.h` was another candidate), just because it has been bothering me for a year now that except for that one file all the headers were in natural alphabetical order by compilation phase... as of this commit we now have them all in alpha order and phase order: common.h -> io.h -> lex.h -> parse.h -> [*] -> sema.h -> cppfront.h [*] coming next here: reflect.h, which will also be in both alpha order and compilation order Guard `out.construct` with `if constexpr` in case the type is not copy assignable and that path is never requested Rename `cpp2::error` to `cpp2::error_entry` to quiet a new(? why?) GCC message about shadowing the former name with `parser::error`... I get why the warning is there, but this is a slightly annoying warning to have to satisfy just to compile high-warning-clean on GCC... oh well Change semantics of emitting `.h2` files: In `-p` pure mode do the existing split of phases 0 and 1 into `.h` and phase 2 into a separate `.hpp`, but in mixed mode put all phases into the `.h`
public this:
is disallowed. But before athis
data member, apublic
non-this
data member is not diagnosed, and has no effect.Minimal reproducer:
Commands:
cppfront x.cpp2 clang++17 -std=c++2b -stdlib=libc++ -I $CPPFRONT_INCLUDE_DIR x.cpp
Expected result: A well-formed program, or a diagnostic.
Actual result and error:
Generated C++1
The text was updated successfully, but these errors were encountered: