File tree 1 file changed +18
-3
lines changed
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -4928,7 +4928,8 @@ class cppfront
4928
4928
decl->get_decl_if_type_scope_object_name_before_a_base_type (*decl->name ())
4929
4929
|| decl->has_name (" this" )
4930
4930
;
4931
- if (emit_as_base) {
4931
+ if (emit_as_base)
4932
+ {
4932
4933
if (decl->has_name (" this" )) {
4933
4934
if (printer.get_phase () == printer.phase1_type_defs_func_decls ) {
4934
4935
printer.print_cpp2 (
@@ -4938,7 +4939,20 @@ class cppfront
4938
4939
separator = " ," ;
4939
4940
}
4940
4941
}
4941
- else {
4942
+ else
4943
+ {
4944
+ if (
4945
+ decl->access
4946
+ && *decl->access != " public"
4947
+ )
4948
+ {
4949
+ errors.emplace_back (
4950
+ decl->position (),
4951
+ " a member object that appears before a 'this' base type object must be private (the default)"
4952
+ );
4953
+ return ;
4954
+ }
4955
+
4942
4956
if (printer.get_phase () == printer.phase1_type_defs_func_decls ) {
4943
4957
printer.print_cpp2 (
4944
4958
separator + " private cpp2::store_as_base<\" "
@@ -4952,7 +4966,8 @@ class cppfront
4952
4966
}
4953
4967
}
4954
4968
// Then we'll switch to start the body == other members
4955
- else {
4969
+ else
4970
+ {
4956
4971
if (printer.get_phase () == printer.phase1_type_defs_func_decls ) {
4957
4972
if (!started_body) {
4958
4973
printer.print_cpp2 (" {" , compound_stmt->position ());
You can’t perform that action at this time.
0 commit comments