diff mbox

[C++] PR 58610

Message ID 530F9E84.2020307@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Feb. 27, 2014, 8:22 p.m. UTC
Hi,

in this regression, we ICE in explain_non_literal_class in:

           if (DECL_DELETED_FN (fn))
             maybe_explain_implicit_delete (fn);

because fn is a TEMPLATE_DECL. Now, if I read the comment which provides 
rationale for LANG_DECL_FN_CHECK:

/* We want to be able to check DECL_CONSTRUCTOR_P and such on a function
    template, not just on a FUNCTION_DECL.  So when looking for things in
    lang_decl_fn, look down through a TEMPLATE_DECL into its result. */
#define LANG_DECL_FN_CHECK(NODE) __extension__                \

I think it could make sense to use the macro for DECL_DELETED_FN too, 
not just for DECL_DEFAULTED_FN. Or do we want something more localized?

Tested x86_64-linux.

Thanks,
Paolo.

/////////////////////////
/cp
2014-02-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58610
	* cp-tree.h (DECL_DELETED_FN): Use LANG_DECL_FN_CHECK.
	* call.c (print_z_candidate): Remove STRIP_TEMPLATE use.

/testsuite
2014-02-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58610
	* g++.dg/cpp0x/constexpr-ice11.C: New.

Comments

Jason Merrill Feb. 28, 2014, 3:57 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: cp/call.c
===================================================================
--- cp/call.c	(revision 208203)
+++ cp/call.c	(working copy)
@@ -3237,7 +3237,7 @@  print_z_candidate (location_t loc, const char *msg
     inform (cloc, "%s%T <conversion>", msg, candidate->fn);
   else if (candidate->viable == -1)
     inform (cloc, "%s%#D <near match>", msg, candidate->fn);
-  else if (DECL_DELETED_FN (STRIP_TEMPLATE (candidate->fn)))
+  else if (DECL_DELETED_FN (candidate->fn))
     inform (cloc, "%s%#D <deleted>", msg, candidate->fn);
   else
     inform (cloc, "%s%#D", msg, candidate->fn);
Index: cp/cp-tree.h
===================================================================
--- cp/cp-tree.h	(revision 208203)
+++ cp/cp-tree.h	(working copy)
@@ -3222,7 +3222,7 @@  more_aggr_init_expr_args_p (const aggr_init_expr_a
 
 /* Nonzero if DECL was declared with '= delete'.  */
 #define DECL_DELETED_FN(DECL) \
-  (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.base.threadprivate_or_deleted_p)
+  (LANG_DECL_FN_CHECK (DECL)->min.base.threadprivate_or_deleted_p)
 
 /* Nonzero if DECL was declared with '= default' (maybe implicitly).  */
 #define DECL_DEFAULTED_FN(DECL) \
Index: testsuite/g++.dg/cpp0x/constexpr-ice11.C
===================================================================
--- testsuite/g++.dg/cpp0x/constexpr-ice11.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/constexpr-ice11.C	(working copy)
@@ -0,0 +1,9 @@ 
+// PR c++/58610
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+  template<typename> A();
+};
+
+constexpr A a;  // { dg-error "literal|matching" }