aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2013-08-05 22:03:52 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2013-08-05 22:03:52 +0000
commitfd9b0f320e88e8d71831b62867627295b77d26b6 (patch)
tree972828ab28f5fc63eb5a27940150211bbef325be /gcc/c-family
parent8ac69a6c3230bd774a6f59f37b864a4bcee81c7c (diff)
downloadgcc-fd9b0f320e88e8d71831b62867627295b77d26b6.zip
gcc-fd9b0f320e88e8d71831b62867627295b77d26b6.tar.gz
gcc-fd9b0f320e88e8d71831b62867627295b77d26b6.tar.bz2
re PR c++/58080 (internal compiler error, decltype in function declaration (for SFINAE purposes))
/c-family 2013-08-05 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58080 * c-common.c (pointer_int_sum): Add bool parameter. * c-common.h (pointer_int_sum): Adjust declaration. /cp 2013-08-05 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58080 * typeck.c (cp_pointer_int_sum): Add tsubst_flags_t parameter. (cp_build_binary_op): Adjust. /testsuite 2013-08-05 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58080 * g++.dg/cpp0x/pr58080.C: New. From-SVN: r201512
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-common.c16
-rw-r--r--gcc/c-family/c-common.h3
3 files changed, 19 insertions, 6 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index b83c536..823c0f7 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2013-08-05 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58080
+ * c-common.c (pointer_int_sum): Add bool parameter.
+ * c-common.h (pointer_int_sum): Adjust declaration.
+
2013-08-05 Gabriel Dos Reis <gdr@integrable-solutions.net>
* c-pretty-print.c (print_c_tree): Simplify. Use non-static local
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 2c806ab..5d1a1c6 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -4284,7 +4284,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
tree
pointer_int_sum (location_t loc, enum tree_code resultcode,
- tree ptrop, tree intop)
+ tree ptrop, tree intop, bool complain)
{
tree size_exp, ret;
@@ -4293,14 +4293,20 @@ pointer_int_sum (location_t loc, enum tree_code resultcode,
if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
{
- pedwarn (loc, OPT_Wpointer_arith,
- "pointer of type %<void *%> used in arithmetic");
+ if (complain && warn_pointer_arith)
+ pedwarn (loc, OPT_Wpointer_arith,
+ "pointer of type %<void *%> used in arithmetic");
+ else if (!complain)
+ return error_mark_node;
size_exp = integer_one_node;
}
else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE)
{
- pedwarn (loc, OPT_Wpointer_arith,
- "pointer to a function used in arithmetic");
+ if (complain && warn_pointer_arith)
+ pedwarn (loc, OPT_Wpointer_arith,
+ "pointer to a function used in arithmetic");
+ else if (!complain)
+ return error_mark_node;
size_exp = integer_one_node;
}
else
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index dc430c3..cc09dbc 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -790,7 +790,8 @@ extern tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwis
and, if so, perhaps change them both back to their original type. */
extern tree shorten_compare (tree *, tree *, tree *, enum tree_code *);
-extern tree pointer_int_sum (location_t, enum tree_code, tree, tree);
+extern tree pointer_int_sum (location_t, enum tree_code, tree, tree,
+ bool = true);
/* Add qualifiers to a type, in the fashion for C. */
extern tree c_build_qualified_type (tree, int);