OSDN Git Service

* call.c (type_decays_to): Check MAYBE_CLASS_TYPE_P instead of
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 13 Apr 2010 17:24:52 +0000 (17:24 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 01:00:08 +0000 (10:00 +0900)
CLASS_TYPE_P.
* parser.c (cp_parser_lambda_expression): Complain about lambda in
unevaluated context.
* pt.c (iterative_hash_template_arg): Don't crash on lambda.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158277 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C [deleted file]

index 0bb6cbb..d6be4b4 100644 (file)
@@ -1,3 +1,11 @@
+2010-04-13  Jason Merrill  <jason@redhat.com>
+
+       * call.c (type_decays_to): Check MAYBE_CLASS_TYPE_P instead of
+       CLASS_TYPE_P.
+       * parser.c (cp_parser_lambda_expression): Complain about lambda in
+       unevaluated context.
+       * pt.c (iterative_hash_template_arg): Don't crash on lambda.
+
 2010-04-12  Jason Merrill  <jason@redhat.com>
 
        PR c++/43641
index 1ed320c..90f84e0 100644 (file)
@@ -2263,7 +2263,7 @@ 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))
+  if (!MAYBE_CLASS_TYPE_P (type))
     type = cv_unqualified (type);
   return type;
 }
index 367608f..29489b6 100644 (file)
@@ -1563,6 +1563,12 @@ iterative_hash_template_arg (tree arg, hashval_t val)
       val = iterative_hash_template_arg (TREE_TYPE (arg), val);
       return iterative_hash_template_arg (TYPE_DOMAIN (arg), val);
 
+    case LAMBDA_EXPR:
+      /* A lambda can't appear in a template arg, but don't crash on
+        erroneous input.  */
+      gcc_assert (errorcount > 0);
+      return val;
+
     default:
       switch (tclass)
        {
index dcc08f5..04274ba 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-13  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/lambda/lambda-deduce2.C: Remove.
+       * g++.dg/cpp0x/lambda/lambda-uneval.C: New.
+
 2010-04-13  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        * gcc.dg/cpp/cpp.exp: Test also c-c++-common/cpp.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C
deleted file mode 100644 (file)
index e92f6f2..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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;