[qfcc] Catch static class instances in structs

This commit is contained in:
Bill Currie 2020-02-29 21:09:24 +09:00
parent e93ca9d828
commit 271d836cd2
1 changed files with 5 additions and 0 deletions

View File

@ -47,6 +47,7 @@
#include <QF/sys.h> #include <QF/sys.h>
#include <QF/va.h> #include <QF/va.h>
#include "class.h"
#include "def.h" #include "def.h"
#include "defspace.h" #include "defspace.h"
#include "diagnostic.h" #include "diagnostic.h"
@ -123,6 +124,10 @@ build_struct (int su, symbol_t *tag, symtab_t *symtab, type_t *type)
for (s = symtab->symbols; s; s = s->next) { for (s = symtab->symbols; s; s = s->next) {
if (s->sy_type != sy_var) if (s->sy_type != sy_var)
continue; continue;
if (obj_is_class (s->type)) {
error (0, "statically allocated instance of class %s",
s->type->t.class->name);
}
if (su == 's') { if (su == 's') {
symtab->size = RUP (symtab->size, s->type->alignment); symtab->size = RUP (symtab->size, s->type->alignment);
s->s.offset = symtab->size; s->s.offset = symtab->size;