diff options
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r-- | gcc/fortran/primary.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 90b1d68..14253f6 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -1888,6 +1888,7 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result) gfc_expr *e; locus where; match m; + bool private_comp = false; head = tail = NULL; @@ -1900,6 +1901,11 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result) for (comp = sym->components; comp; comp = comp->next) { + if (comp->access == ACCESS_PRIVATE) + { + private_comp = true; + break; + } if (head == NULL) tail = head = gfc_get_constructor (); else @@ -1928,6 +1934,14 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result) break; } + if (sym->attr.use_assoc + && (sym->component_access == ACCESS_PRIVATE || private_comp)) + { + gfc_error ("Structure constructor for '%s' at %C has PRIVATE " + "components", sym->name); + goto cleanup; + } + if (gfc_match_char (')') != MATCH_YES) goto syntax; |