Commit c86818cf by Shujing Zhao Committed by Paolo Carlini

re PR c++/29017 (%s substituted with different untranslated words can't be properly translated)

/cp
2009-11-20  Shujing Zhao  <pearly.zhao@oracle.com>

	PR c++/29017
	* cp-tree.h (composite_pointer_operation): New type.
	(composite_pointer_type): Adjust prototype with new argument.
	* typeck.c (composite_pointer_type): Accept
	composite_pointer_operation as argument and emit diagnostic to be
	visible to gettext and checked at compile time.
	(composite_pointer_type_r): Likewise.
	(common_pointer_type): Update call to composite_pointer_type.
	(cp_build_binary_op): Likewise.
	* call.c (build_conditional_expr): Likewise.

/testsuite
2009-11-20  Shujing Zhao  <pearly.zhao@oracle.com>

	* g++.old-deja/g++.jason/rfg20.C: Make expected dg-error strings
	explicit.
	* g++.old-deja/g++.rfg/00321_01-.C: Likewise.
	* g++.old-deja/g++.rfg/00324_02-.C: Likewise.
	* g++.old-deja/g++.law/typeck1.C: Likewise.
	* g++.old-deja/g++.bugs/900324_02.C: Likewise.
	* g++.dg/conversion/ptrmem9.C: Likewise.
	* g++.dg/expr/cond2.C: Likewise.

From-SVN: r154360
parent 3de8a540
2009-11-20 Shujing Zhao <pearly.zhao@oracle.com>
PR c++/29017
* cp-tree.h (composite_pointer_operation): New type.
(composite_pointer_type): Adjust prototype with new argument.
* typeck.c (composite_pointer_type): Accept
composite_pointer_operation as argument and emit diagnostic to be
visible to gettext and checked at compile time.
(composite_pointer_type_r): Likewise.
(common_pointer_type): Update call to composite_pointer_type.
(cp_build_binary_op): Likewise.
* call.c (build_conditional_expr): Likewise.
2009-11-19 Jason Merrill <jason@redhat.com>
PR c++/42115
......
......@@ -3977,7 +3977,7 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
|| (TYPE_PTRMEMFUNC_P (arg2_type) && TYPE_PTRMEMFUNC_P (arg3_type)))
{
result_type = composite_pointer_type (arg2_type, arg3_type, arg2,
arg3, "conditional expression",
arg3, CPO_CONDITIONAL_EXPR,
complain);
if (result_type == error_mark_node)
return error_mark_node;
......
......@@ -403,6 +403,17 @@ typedef enum cpp0x_warn_str
CPP0X_DEFAULTED_DELETED
} cpp0x_warn_str;
/* The various kinds of operation used by composite_pointer_type. */
typedef enum composite_pointer_operation
{
/* comparison */
CPO_COMPARISON,
/* conversion */
CPO_CONVERSION,
/* conditional expression */
CPO_CONDITIONAL_EXPR
} composite_pointer_operation;
/* Macros for access to language-specific slots in an identifier. */
......@@ -5281,7 +5292,8 @@ extern void expand_ptrmemfunc_cst (tree, tree *, tree *);
extern tree type_after_usual_arithmetic_conversions (tree, tree);
extern tree common_pointer_type (tree, tree);
extern tree composite_pointer_type (tree, tree, tree, tree,
const char*, tsubst_flags_t);
composite_pointer_operation,
tsubst_flags_t);
extern tree merge_types (tree, tree);
extern tree check_return_expr (tree, bool *);
extern tree cp_build_binary_op (location_t,
......
2009-11-20 Shujing Zhao <pearly.zhao@oracle.com>
* g++.old-deja/g++.jason/rfg20.C: Make expected dg-error strings
explicit.
* g++.old-deja/g++.rfg/00321_01-.C: Likewise.
* g++.old-deja/g++.rfg/00324_02-.C: Likewise.
* g++.old-deja/g++.law/typeck1.C: Likewise.
* g++.old-deja/g++.bugs/900324_02.C: Likewise.
* g++.dg/conversion/ptrmem9.C: Likewise.
* g++.dg/expr/cond2.C: Likewise.
2009-11-20 Paul Thomas <pault@gcc.gnu.org>
Janus Weil <janus@gcc.gnu.org>
......
......@@ -22,5 +22,5 @@ void f ()
pd == pb;
pd == pbv; // { dg-error "" }
pd == pc; // { dg-error "" }
pd == pc; // { dg-error "comparison between distinct pointer-to-member types" }
}
......@@ -8,5 +8,5 @@ struct IsZero : Term {
Term*
IsZero::eval()
{
return true ? new Boolean(false) : this; // { dg-error "" }
return true ? new Boolean(false) : this; // { dg-error "conditional expression" }
}
......@@ -13,7 +13,7 @@ void (*fp)(void);
void function_1 ()
{
fp = 1 ? function_0 : fp; // { dg-error "" }
fp = 1 ? function_0 : fp; // { dg-error "conditional expression|invalid conversion" }
}
int main () { return 0; }
......@@ -6,5 +6,5 @@ void *vp;
void example ()
{
vp != fp; // { dg-error "" } no conversion from pfn to void*
vp != fp; // { dg-error "forbids comparison" } no conversion from pfn to void*
}
......@@ -13,6 +13,6 @@
int test( const foo* f, const bar* b )
{
return f == b;// { dg-error "" }
return f == b;// { dg-error "comparison between distinct pointer types" }
}
......@@ -9,6 +9,6 @@ int (*p2)[5];
void
test ()
{
p1 == p2; // { dg-error "" } comparison.*
p1 > p2; // { dg-error "" } comparison.*
p1 == p2; // { dg-error "comparison between distinct pointer types" } comparison.*
p1 > p2; // { dg-error "comparison between distinct pointer types" } comparison.*
}
......@@ -12,5 +12,5 @@ int i;
void
test ()
{
i ? f : fp; // { dg-error "" }
i ? f : fp; // { dg-error "conditional expression|invalid conversion" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment