mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-23 02:41:30 +00:00
Catch attempts to create a static instance of a class.
It is actually an error to create a static instance of a class.
This commit is contained in:
parent
f7006f13e8
commit
45c753f639
1 changed files with 7 additions and 0 deletions
|
@ -46,6 +46,7 @@
|
|||
#include "QF/va.h"
|
||||
|
||||
#include "qfcc.h"
|
||||
#include "class.h"
|
||||
#include "def.h"
|
||||
#include "defspace.h"
|
||||
#include "diagnostic.h"
|
||||
|
@ -139,6 +140,12 @@ new_def (const char *name, type_t *type, defspace_t *space,
|
|||
if (!space && storage != sc_extern)
|
||||
internal_error (0, "non-external def with no storage space");
|
||||
|
||||
if (is_class (type)) {
|
||||
error (0, "statically allocated instance of class %s",
|
||||
type->t.class->name);
|
||||
return def;
|
||||
}
|
||||
|
||||
if (storage != sc_extern) {
|
||||
int size = type_size (type);
|
||||
if (!size) {
|
||||
|
|
Loading…
Reference in a new issue