typeck2.c (build_functional_cast): Don't try to avoid calling build_value_init.
authorJason Merrill <jason@redhat.com>
Tue, 23 Aug 2011 16:03:57 +0000 (12:03 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 23 Aug 2011 16:03:57 +0000 (12:03 -0400)
* typeck2.c (build_functional_cast): Don't try to avoid calling
build_value_init.
* pt.c (instantiate_class_template_1): Don't copy TYPE_HAS_* flags.

From-SVN: r177999

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/cp/typeck2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash7.C

index 4870f3570fe66b0e9e0e40c9a1ce1fe13a30878e..390a7982ecb3aca4292826398f92d0c4d9ac1b27 100644 (file)
@@ -1,3 +1,9 @@
+2011-08-23  Jason Merrill  <jason@redhat.com>
+
+       * typeck2.c (build_functional_cast): Don't try to avoid calling
+       build_value_init.
+       * pt.c (instantiate_class_template_1): Don't copy TYPE_HAS_* flags.
+
 2011-08-23  Jason Merrill  <jason@redhat.com>
 
        PR c++/49045
index 6b970f97777c4b6d03bccef92f228bbce9cbf562..3c6b2c54a99bc4c53dd64523ebfb005da5f42438 100644 (file)
@@ -8503,16 +8503,6 @@ instantiate_class_template_1 (tree type)
   input_location = DECL_SOURCE_LOCATION (TYPE_NAME (type)) =
     DECL_SOURCE_LOCATION (typedecl);
 
-  TYPE_HAS_USER_CONSTRUCTOR (type) = TYPE_HAS_USER_CONSTRUCTOR (pattern);
-  TYPE_HAS_NEW_OPERATOR (type) = TYPE_HAS_NEW_OPERATOR (pattern);
-  TYPE_HAS_ARRAY_NEW_OPERATOR (type) = TYPE_HAS_ARRAY_NEW_OPERATOR (pattern);
-  TYPE_GETS_DELETE (type) = TYPE_GETS_DELETE (pattern);
-  TYPE_HAS_COPY_ASSIGN (type) = TYPE_HAS_COPY_ASSIGN (pattern);
-  TYPE_HAS_CONST_COPY_ASSIGN (type) = TYPE_HAS_CONST_COPY_ASSIGN (pattern);
-  TYPE_HAS_COPY_CTOR (type) = TYPE_HAS_COPY_CTOR (pattern);
-  TYPE_HAS_CONST_COPY_CTOR (type) = TYPE_HAS_CONST_COPY_CTOR (pattern);
-  TYPE_HAS_DEFAULT_CONSTRUCTOR (type) = TYPE_HAS_DEFAULT_CONSTRUCTOR (pattern);
-  TYPE_HAS_CONVERSION (type) = TYPE_HAS_CONVERSION (pattern);
   TYPE_PACKED (type) = TYPE_PACKED (pattern);
   TYPE_ALIGN (type) = TYPE_ALIGN (pattern);
   TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (pattern);
index 97f98ab3507cb3defe75bf96da34e6c99bdaf99e..901e4ee2462030a8d2954d3ecb8332089a9f38a4 100644 (file)
@@ -1677,10 +1677,7 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain)
      void type, creates an rvalue of the specified type, which is
      value-initialized.  */
 
-  if (parms == NULL_TREE
-      /* If there's a user-defined constructor, value-initialization is
-        just calling the constructor, so fall through.  */
-      && !TYPE_HAS_USER_CONSTRUCTOR (type))
+  if (parms == NULL_TREE)
     {
       exp = build_value_init (type, complain);
       exp = get_target_expr_sfinae (exp, complain);
index bacec37e9ace6141cd691e96d6c0a9e47232bb28..633af2b8c635714456c2ad4d50328027fc574a89 100644 (file)
@@ -1,3 +1,7 @@
+2011-08-23  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/template/crash7.C: Adjust expected errors.
+
 2011-08-23  Jason Merrill  <jason@redhat.com>
 
        PR c++/49045
index 88d3af86009846955ca0c964b287ffd72a42a6bd..5bd275e3255d197e7f8376ee21ca58b46dea340b 100644 (file)
@@ -5,10 +5,11 @@
 // PR c++/10108: ICE in tsubst_decl for error due to non-existence
 // nested type.
 
-template <typename> struct A   // { dg-message "A.void.::A.const A" }
+template <typename> struct A
 {
     template <typename> A(typename A::X) {} // { dg-error "no type" }
 };
 
-A<void> a;     // { dg-error "required|no match" }
-// { dg-prune-output "note" }
+// We currently don't give the "no match" error because we don't add the
+// invalid constructor template to TYPE_METHODS.
+A<void> a;                     // { dg-message "required" }