diff options
author | Jason Merrill <jason@redhat.com> | 2011-06-21 15:05:25 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-06-21 15:05:25 -0400 |
commit | 293678445f2f62406fabf6a70c2bdbae4e8346f3 (patch) | |
tree | 969eefc4a892758a5b33d473d30d165e8b76b51f /gcc | |
parent | e0a8ecf2a2df715d56d193bd80f2c60dc1851359 (diff) | |
download | gcc-293678445f2f62406fabf6a70c2bdbae4e8346f3.zip gcc-293678445f2f62406fabf6a70c2bdbae4e8346f3.tar.gz gcc-293678445f2f62406fabf6a70c2bdbae4e8346f3.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/call.c | 2 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/param3.C | 12 |
5 files changed, 24 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 97bead8..558e756 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index caf95b0..3ac7a8e 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -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; } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 1c9d70a..594d239 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2f03f2a..b204070 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/template/param3.C b/gcc/testsuite/g++.dg/template/param3.C new file mode 100644 index 0000000..0c1e703 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/param3.C @@ -0,0 +1,12 @@ +// PR c++/49418 + +template <class T> +void f (const T t) +{ + t = 1; // { dg-error "" } +} + +int main() +{ + f(1); +} |