aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-04-12 15:58:37 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-04-12 15:58:37 -0400
commitd68504839c134133fb96bfcfee4ef55ad95f4fa6 (patch)
treea7715d4cf8d175e1f57f35aadc90a8ac4057bfdc /gcc
parent9d809e8f576a99800ee09ab72cbcb1c2b3250c34 (diff)
downloadgcc-d68504839c134133fb96bfcfee4ef55ad95f4fa6.zip
gcc-d68504839c134133fb96bfcfee4ef55ad95f4fa6.tar.gz
gcc-d68504839c134133fb96bfcfee4ef55ad95f4fa6.tar.bz2
* call.c (type_decays_to): Call cv_unqualified for non-class type.
From-SVN: r158240
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C15
4 files changed, 25 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c32e19f..00aa53e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-12 Jason Merrill <jason@redhat.com>
+
+ * call.c (type_decays_to): Call cv_unqualified for non-class type.
+
2010-04-12 Fabien Chene <fabien.chene@gmail.com>
PR c++/25811
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 5a32b3b..1ed320c 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2263,6 +2263,8 @@ type_decays_to (tree type)
return build_pointer_type (TREE_TYPE (type));
if (TREE_CODE (type) == FUNCTION_TYPE)
return build_pointer_type (type);
+ if (!CLASS_TYPE_P (type))
+ type = cv_unqualified (type);
return type;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4b79ce0..b73eaa8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-12 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/lambda/lambda-deduce2.C: New.
+
2010-04-12 Fabien Chene <fabien.chene@gmail.com>
PR c++/25811
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C
new file mode 100644
index 0000000..e92f6f2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C
@@ -0,0 +1,15 @@
+// Test that cv-quals are dropped from non-class return type
+// { dg-options "-std=c++0x" }
+
+template <class T, class U>
+struct assert_same_type;
+template <class T>
+struct assert_same_type<T,T> { };
+
+struct A
+{
+ int i;
+};
+
+extern const int i;
+assert_same_type <decltype ([]{ return i; }()), int> x;