Index: /trunk/RELEASE_NOTES.txt
===================================================================
--- /trunk/RELEASE_NOTES.txt	(revision 5047)
+++ /trunk/RELEASE_NOTES.txt	(revision 5048)
@@ -29,6 +29,9 @@
     grammar rules.
 
-    Fixed a bug where a failed load of a settings file could be reported as
-    successful.
+    Corrected a bug where a failed load of a settings file could be reported
+    as successful.
+
+    Corrected a bug when compiling an object or category normal predicate that
+    redefines a built-in Prolog meta-predicate.
 
     Added missing dynamic directives in the definition of the pseudo-objects
Index: /trunk/compiler/logtalk.pl
===================================================================
--- /trunk/compiler/logtalk.pl	(revision 5047)
+++ /trunk/compiler/logtalk.pl	(revision 5048)
@@ -3629,11 +3629,15 @@
 
 
-% '$lgt_call_built_in'(+callable, +execution_context)
+% '$lgt_call_built_in'(+callable, +callable, +execution_context)
 %
 % needed for runtime translation of dynamic clauses, for dealing
 % with meta-calls that turn out to be calls to built-in predicates,
 % and for dealing with <</2 calls to redefined built-in predicates
-
-'$lgt_call_built_in'(Pred, ExCtx) :-
+%
+% the first argument, Pred, is the original predicate call, while the second
+% argument, MetaExPred, is equal to the first argument for normal predicates
+% but is meta-argument expanded for non-redefined built-in meta-predicates
+
+'$lgt_call_built_in'(Pred, MetaExPred, ExCtx) :-
 	(	'$lgt_exec_ctx'(ExCtx, This, _),
 		'$lgt_current_object_'(This, _, _, Def, _, _, _, _, DDef, _, _),
@@ -3645,5 +3649,5 @@
 		)
 	;	% call the built-in predicate:
-		call(Pred)
+		call(MetaExPred)
 	).
 
@@ -9154,5 +9158,5 @@
 % Prolog proprietary, built-in meta-predicates
 
-'$lgt_tr_body'(Pred, '$lgt_call_built_in'(TPred, ExCtx), DPred, Ctx) :-
+'$lgt_tr_body'(Pred, '$lgt_call_built_in'(Pred, TPred, ExCtx), DPred, Ctx) :-
 	'$lgt_pl_built_in'(Pred),
 	functor(Pred, Functor, Arity),
@@ -9182,6 +9186,6 @@
 	(	Type == control_construct ->
 		DGoal =.. [Functor| DArgs],
-		DPred = '$lgt_call_built_in'(DGoal, Ctx)
-	;	DPred = '$lgt_dbg_goal'(Pred, '$lgt_call_built_in'(TPred, ExCtx), ExCtx)
+		DPred = '$lgt_call_built_in'(Pred, DGoal, Ctx)
+	;	DPred = '$lgt_dbg_goal'(Pred, '$lgt_call_built_in'(Pred, TPred, ExCtx), ExCtx)
 	).
 
@@ -9189,5 +9193,5 @@
 % Logtalk and Prolog built-in predicates
 
-'$lgt_tr_body'(Pred, '$lgt_call_built_in'(Pred, ExCtx), '$lgt_dbg_goal'(Pred, '$lgt_call_built_in'(Pred, ExCtx), ExCtx), Ctx) :-
+'$lgt_tr_body'(Pred, '$lgt_call_built_in'(Pred, Pred, ExCtx), '$lgt_dbg_goal'(Pred, '$lgt_call_built_in'(Pred, Pred, ExCtx), ExCtx), Ctx) :-
 	'$lgt_built_in'(Pred),
 	functor(Pred, Functor, Arity),
@@ -12127,9 +12131,9 @@
 	TPred =.. [Functor| TArgs].
 
-'$lgt_fix_pred_calls'('$lgt_call_built_in'(Pred, ExCtx), TPred) :-
-	!,									% calls to Logtalk and Prolog built-in predicates
+'$lgt_fix_pred_calls'('$lgt_call_built_in'(Pred, MetaExPred, ExCtx), TPred) :-
+	!,									% calls to Logtalk and Prolog built-in (meta-)predicates
 	(	'$lgt_pp_redefined_built_in_'(Pred, ExCtx, TPred) ->
 		true
-	;	'$lgt_fix_pred_calls'(Pred, TPred)
+	;	'$lgt_fix_pred_calls'(MetaExPred, TPred)
 	).
 
@@ -12204,8 +12208,8 @@
 	\+ '$lgt_pp_defs_nt_'(Functor, Arity),					% non-terminal not defined in object/category and
 	ExtArity is Arity + 2,
-	\+ '$lgt_pp_defs_pred_'(Functor, ExtArity),		% no corresponding predicate is defined
-	\+ '$lgt_pp_dynamic_'(Functor, ExtArity),			% no dynamic directive for the corresponding predicate 
-	once((	'$lgt_pp_public_'(Functor, ExtArity)		% but there is a scope directive for the non-terminal 
-		;	'$lgt_pp_protected_'(Functor, ExtArity)	% or the corresponding predicate 
+	\+ '$lgt_pp_defs_pred_'(Functor, ExtArity),				% no corresponding predicate is defined
+	\+ '$lgt_pp_dynamic_'(Functor, ExtArity),				% no dynamic directive for the corresponding predicate 
+	once((	'$lgt_pp_public_'(Functor, ExtArity)			% but there is a scope directive for the non-terminal 
+		;	'$lgt_pp_protected_'(Functor, ExtArity)			% or the corresponding predicate 
 		;	'$lgt_pp_private_'(Functor, ExtArity)
 	)).
