OSDN Git Service

* call.c (type_decays_to): Call cv_unqualified for non-class type.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Apr 2010 19:58:37 +0000 (19:58 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Apr 2010 19:58:37 +0000 (19:58 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158240 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C [new file with mode: 0644]

index c32e19f..00aa53e 100644 (file)
@@ -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
index 5a32b3b..1ed320c 100644 (file)
@@ -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;
 }
 
index 4b79ce0..b73eaa8 100644 (file)
@@ -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 (file)
index 0000000..e92f6f2
--- /dev/null
@@ -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;