diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-20 16:05:58 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-20 16:05:58 +0000 |
commit | 5b16c15258c092654e8f63422cf7c25f30b67dec (patch) | |
tree | 4118ccc91f98aed95bebab381ba860beed6cf709 /gcc/c-common.c | |
parent | 43ffec670f9e7fe67294493fd8b839dbd79d8eec (diff) | |
download | gcc-5b16c15258c092654e8f63422cf7c25f30b67dec.tar.gz |
2008-08-20 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/35602
* c-common.c (conversion_warning): Do not warn for artificial
expressions.
testsuite/
* g++.dg/warn/pr35602.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139328 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 639601d4fcd..92e58c9fb00 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1556,11 +1556,22 @@ conversion_warning (tree type, tree expr) { bool give_warning = false; + int i; + const int expr_num_operands = TREE_OPERAND_LENGTH (expr); tree expr_type = TREE_TYPE (expr); if (!warn_conversion && !warn_sign_conversion) return; + /* If any operand is artificial, then this expression was generated + by the compiler and we do not warn. */ + for (i = 0; i < expr_num_operands; i++) + { + tree op = TREE_OPERAND (expr, i); + if (DECL_P (op) && DECL_ARTIFICIAL (op)) + return; + } + switch (TREE_CODE (expr)) { case EQ_EXPR: |