semantic/constant-pointer.test \
semantic/constant-reassignment-element.test \
semantic/constant-reassignment-member.test \
+ semantic/constant-type-less-accessible.test \
semantic/constant-value.test \
semantic/constant-value-missing.test \
semantic/constant-value-type.test \
semantic/signal-disconnect-empty-invalid.test \
semantic/signal-disconnect-invalid.test \
semantic/signal-return-valist.test \
+ semantic/struct-base-type-less-accessible.test \
semantic/struct-field-initializer.test \
semantic/struct-invalid-base.test \
semantic/struct-recursive.test \
--- /dev/null
+Invalid Code
+
+struct Bar {
+ public int i;
+}
+
+public const Bar FOO = { 42 };
+
+void main () {
+}
--- /dev/null
+Invalid Code
+
+struct Bar {
+ public int i;
+}
+
+public struct Foo : Bar {
+}
+
+void main () {
+}
return false;
}
+ // check whether constant type is at least as accessible as the constant
+ if (!context.analyzer.is_type_accessible (this, type_reference)) {
+ error = true;
+ Report.error (source_reference, "constant type `%s' is less accessible than constant `%s'", type_reference.to_string (), get_full_name ());
+ }
+
if (!external) {
if (value == null) {
// constants from fast-vapi files are special
Report.error (source_reference, "The base type `%s' of struct `%s' is not a struct", base_type.to_string (), get_full_name ());
return false;
}
+
+ // check whether base type is at least as accessible as the struct
+ if (!context.analyzer.is_type_accessible (this, base_type)) {
+ error = true;
+ Report.error (source_reference, "base type `%s' is less accessible than struct `%s'", base_type.to_string (), get_full_name ());
+ }
}
foreach (TypeParameter p in type_parameters) {