diff --git a/compiler2/ttcn3/Ttcnstuff.cc b/compiler2/ttcn3/Ttcnstuff.cc
index 033d2450dd8c86dc973280c4d5777b3fe83da4bb..161ac90724b3b17d10650993fb8b5624ca749ed7 100644
--- a/compiler2/ttcn3/Ttcnstuff.cc
+++ b/compiler2/ttcn3/Ttcnstuff.cc
@@ -3478,7 +3478,7 @@ namespace Ttcn {
             		    local_id.get_dispname().c_str());
             	  }
             	  else if (base_func->get_visibility() == NOCHANGE &&
-            			   (local_func->get_visibility() != PUBLIC || local_func->get_visibility() != NOCHANGE)) {
+            			   local_func->get_visibility() != PUBLIC && local_func->get_visibility() != NOCHANGE) {
             		  local_def->error("Protected methods can be only overridden by "
             		    "public or protected methods `%s'", local_id.get_dispname().c_str());
             	  }