Commit d179d179 by Jason Merrill Committed by Jason Merrill

re PR c++/51151 (Invalid -Woverflow warning in C++ frontend)

	PR c++/51151
	* call.c (perform_implicit_conversion_flags): Remove earlier kludge.
	* parser.c (cp_parser_omp_for_loop): Use cp_parser_omp_for_incr
	in templates even if decl isn't type-dependent.

From-SVN: r182175
parent 9b81593b
2011-12-09 Jason Merrill <jason@redhat.com>
PR c++/51151
* call.c (perform_implicit_conversion_flags): Remove earlier kludge.
* parser.c (cp_parser_omp_for_loop): Use cp_parser_omp_for_incr
in templates even if decl isn't type-dependent.
2011-12-09 Dodji Seketeli <dodji@redhat.com> 2011-12-09 Dodji Seketeli <dodji@redhat.com>
PR c++/51289 PR c++/51289
......
...@@ -8437,10 +8437,7 @@ perform_implicit_conversion_flags (tree type, tree expr, tsubst_flags_t complain ...@@ -8437,10 +8437,7 @@ perform_implicit_conversion_flags (tree type, tree expr, tsubst_flags_t complain
} }
expr = error_mark_node; expr = error_mark_node;
} }
else if (processing_template_decl else if (processing_template_decl && conv->kind != ck_identity)
/* As a kludge, we always perform conversions between scalar
types, as IMPLICIT_CONV_EXPR confuses c_finish_omp_for. */
&& !(SCALAR_TYPE_P (type) && SCALAR_TYPE_P (TREE_TYPE (expr))))
{ {
/* In a template, we are only concerned about determining the /* In a template, we are only concerned about determining the
type of non-dependent expressions, so we do not have to type of non-dependent expressions, so we do not have to
......
...@@ -26305,7 +26305,7 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses) ...@@ -26305,7 +26305,7 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses)
/* If decl is an iterator, preserve the operator on decl /* If decl is an iterator, preserve the operator on decl
until finish_omp_for. */ until finish_omp_for. */
if (decl if (decl
&& ((type_dependent_expression_p (decl) && ((processing_template_decl
&& !POINTER_TYPE_P (TREE_TYPE (decl))) && !POINTER_TYPE_P (TREE_TYPE (decl)))
|| CLASS_TYPE_P (TREE_TYPE (decl)))) || CLASS_TYPE_P (TREE_TYPE (decl))))
incr = cp_parser_omp_for_incr (parser, decl); incr = cp_parser_omp_for_incr (parser, decl);
......
2011-12-09 Jason Merrill <jason@redhat.com>
PR c++/51151
* g++.dg/warn/Woverflow-4.C: New.
2011-12-09 Dodji Seketeli <dodji@redhat.com> 2011-12-09 Dodji Seketeli <dodji@redhat.com>
PR c++/51289 PR c++/51289
......
// PR c++/51151
// { dg-options "-Wshadow" }
template<typename T> class C {
public:
void f() {
m = c2 + 1;
}
static const long unsigned int c1 = 7;
static const int c2 = c1 - 1;
int m;
};
template class C<int>;
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