class.c (finalize_literal_type_property): Update conditions.
authorJason Merrill <jason@redhat.com>
Wed, 29 Jun 2011 14:34:39 +0000 (10:34 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 29 Jun 2011 14:34:39 +0000 (10:34 -0400)
* class.c (finalize_literal_type_property): Update conditions.
* method.c (defaulted_late_check): Set TYPE_HAS_CONSTEXPR_CTOR.

From-SVN: r175644

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/method.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-is_literal.C

index e25f4e04490b29e2716e33c8f4643cd3d8652072..61778830bf1ff47d297acd21c40b14044f2fca8f 100644 (file)
@@ -1,5 +1,8 @@
 2011-06-29  Jason Merrill  <jason@redhat.com>
 
+       * class.c (finalize_literal_type_property): Update conditions.
+       * method.c (defaulted_late_check): Set TYPE_HAS_CONSTEXPR_CTOR.
+
        * tree.c (build_vec_init_expr): Don't add TARGET_EXPR.
        * typeck2.c (digest_init_r): Handle VEC_INIT_EXPR.
        * semantics.c (cxx_eval_vec_init_1): Correct type.
index 9e387a6923e7bb595b7b37df49d31e1958a27d6e..9054b5caa18975511d95f60a258206cfbe44d8aa 100644 (file)
@@ -4566,12 +4566,10 @@ finalize_literal_type_property (tree t)
   tree fn;
 
   if (cxx_dialect < cxx0x
-      || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
-      /* FIXME These constraints seem unnecessary; remove from standard.
-        || !TYPE_HAS_TRIVIAL_COPY_CTOR (t)
-        || TYPE_HAS_COMPLEX_MOVE_CTOR (t)*/ )
+      || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
     CLASSTYPE_LITERAL_P (t) = false;
   else if (CLASSTYPE_LITERAL_P (t) && !TYPE_HAS_TRIVIAL_DFLT (t)
+          && CLASSTYPE_NON_AGGREGATE (t)
           && !TYPE_HAS_CONSTEXPR_CTOR (t))
     CLASSTYPE_LITERAL_P (t) = false;
 
index 48b9c74e78e5cf52cfb6428567806e7c14e30058..de43a386f774d22be36a2390aa668b875cd59d7d 100644 (file)
@@ -1571,10 +1571,14 @@ defaulted_late_check (tree fn)
        }
       TREE_TYPE (fn) = build_exception_variant (TREE_TYPE (fn), eh_spec);
       if (DECL_DECLARED_CONSTEXPR_P (implicit_fn))
-       /* Hmm...should we do this for out-of-class too? Should it be OK to
-          add constexpr later like inline, rather than requiring
-          declarations to match?  */
-       DECL_DECLARED_CONSTEXPR_P (fn) = true;
+       {
+         /* Hmm...should we do this for out-of-class too? Should it be OK to
+            add constexpr later like inline, rather than requiring
+            declarations to match?  */
+         DECL_DECLARED_CONSTEXPR_P (fn) = true;
+         if (kind == sfk_constructor)
+           TYPE_HAS_CONSTEXPR_CTOR (ctx) = true;
+       }
     }
 
   if (!DECL_DECLARED_CONSTEXPR_P (implicit_fn)
index 6fefc38798864832a14fe53530743e073fdae858..4e2ebc3a155f4b64a41e43d30fa8619716ddc27d 100644 (file)
@@ -1,3 +1,7 @@
+2011-06-29  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/constexpr-is_literal.C: Adjust.
+
 2011-06-29  Richard Guenther  <rguenther@suse.de>
 
        * gcc.dg/tree-ssa/loop-17.c: Adjust.
index d1b95437db38592a51f464bda6e7e55744d513e2..82514ed865a56ba4961d64be6d95df8a2a5733e1 100644 (file)
@@ -33,6 +33,7 @@ YES(NotLiteral (NotLiteral::*)(NotLiteral));
 
 struct A {
   A(const A&) = default;
+  A(int);
 };
 
 NO(A);                         // no constexpr ctor other than copy