From d68504839c134133fb96bfcfee4ef55ad95f4fa6 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 12 Apr 2010 15:58:37 -0400 Subject: * call.c (type_decays_to): Call cv_unqualified for non-class type. From-SVN: r158240 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/call.c | 2 ++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C | 15 +++++++++++++++ 4 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C (limited to 'gcc') 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 + + * call.c (type_decays_to): Call cv_unqualified for non-class type. + 2010-04-12 Fabien Chene 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 + + * g++.dg/cpp0x/lambda/lambda-deduce2.C: New. + 2010-04-12 Fabien Chene 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 +struct assert_same_type; +template +struct assert_same_type { }; + +struct A +{ + int i; +}; + +extern const int i; +assert_same_type x; -- cgit v1.1