Skip to content

Commit f3550ea

Browse files
committed
Cleanup: is_virtual is trivally true in this context
1 parent a172c34 commit f3550ea

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/cpp/cpp_typecheck_compound_type.cpp

+9-13
Original file line numberDiff line numberDiff line change
@@ -490,22 +490,18 @@ void cpp_typecheckt::typecheck_compound_declarator(
490490
component.type().set("#virtual_name", virtual_name);
491491

492492
// Check if it is a pure virtual method
493-
if(is_virtual)
493+
if(value.is_not_nil() && value.id() == ID_constant)
494494
{
495-
if(value.is_not_nil() && value.id()==ID_constant)
495+
mp_integer i;
496+
to_integer(value, i);
497+
if(i!=0)
496498
{
497-
mp_integer i;
498-
to_integer(value, i);
499-
if(i!=0)
500-
{
501-
error().source_location=declarator.name().source_location();
502-
error() << "expected 0 to mark pure virtual method, got "
503-
<< i << eom;
504-
throw 0;
505-
}
506-
component.set("is_pure_virtual", true);
507-
value.make_nil();
499+
error().source_location = declarator.name().source_location();
500+
error() << "expected 0 to mark pure virtual method, got " << i << eom;
501+
throw 0;
508502
}
503+
component.set("is_pure_virtual", true);
504+
value.make_nil();
509505
}
510506

511507
typecheck_member_function(

0 commit comments

Comments
 (0)