Skip to content

Commit 77f9fa2

Browse files
committed
Cleanup: is_virtual is trivally true in this context
1 parent 03de5d0 commit 77f9fa2

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/cpp/cpp_typecheck_compound_type.cpp

+10-13
Original file line numberDiff line numberDiff line change
@@ -490,22 +490,19 @@ 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 "
501+
<< i << eom;
502+
throw 0;
508503
}
504+
component.set("is_pure_virtual", true);
505+
value.make_nil();
509506
}
510507

511508
typecheck_member_function(

0 commit comments

Comments
 (0)