Skip to content

Commit 09cfca5

Browse files
committed
Add diagnostic for non-object this member, closes #898
1 parent 62027b2 commit 09cfca5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source/sema.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,13 @@ class sema
12371237
&& n.parent_is_type()
12381238
)
12391239
{
1240-
assert(n.is_object());
1240+
if (!n.is_object()) {
1241+
errors.emplace_back(
1242+
n.position(),
1243+
"a member named 'this' declares a base subobject, and must be followed by a base type name"
1244+
);
1245+
return false;
1246+
}
12411247

12421248
if (
12431249
!n.is_public()

0 commit comments

Comments
 (0)