re PR c++/49418 (G++ discards cv-quals from template parameter types)

PR c++/49418
	* call.c (cxx_type_promotes_to): Don't strip cv-quals.
	* semantics.c (lambda_return_type): Strip them here.

From-SVN: r175271
This commit is contained in:
Jason Merrill 2011-06-21 15:05:25 -04:00 committed by Jason Merrill
parent e0a8ecf2a2
commit 293678445f
5 changed files with 24 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2011-06-21 Jason Merrill <jason@redhat.com>
PR c++/49418
* call.c (cxx_type_promotes_to): Don't strip cv-quals.
* semantics.c (lambda_return_type): Strip them here.
2011-06-21 Andrew MacLeod <amacleod@redhat.com>
* semantics.c: Add sync_ or SYNC__ to builtin names.

View File

@ -2640,8 +2640,6 @@ type_decays_to (tree type)
return build_pointer_type (TREE_TYPE (type));
if (TREE_CODE (type) == FUNCTION_TYPE)
return build_pointer_type (type);
if (!MAYBE_CLASS_TYPE_P (type))
type = cv_unqualified (type);
return type;
}

View File

@ -8177,7 +8177,7 @@ lambda_return_type (tree expr)
SET_TYPE_STRUCTURAL_EQUALITY (type);
}
else
type = type_decays_to (unlowered_expr_type (expr));
type = cv_unqualified (type_decays_to (unlowered_expr_type (expr)));
return type;
}

View File

@ -1,3 +1,8 @@
2011-06-21 Jason Merrill <jason@redhat.com>
PR c++/49418
* g++.dg/template/param3.C: New.
2011-06-21 Bernd Schmidt <bernds@codesourcery.com>
* gcc.c-torture/excute/builtin-bitops-1.c (MAKE_FUNS): Make

View File

@ -0,0 +1,12 @@
// PR c++/49418
template <class T>
void f (const T t)
{
t = 1; // { dg-error "" }
}
int main()
{
f(1);
}