re PR c++/48530 ([C++0x][SFINAE] Hard errors with deleted d'tors)
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 28 Apr 2011 09:54:04 +0000 (09:54 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 28 Apr 2011 09:54:04 +0000 (09:54 +0000)
/cp
2011-04-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/48530
* tree.c (build_cplus_new): Check build_target_expr return
value for error_mark_node.

/testsuite
2011-04-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/48530
* g++.dg/cpp0x/sfinae18.C: New.

From-SVN: r173063

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/sfinae18.C [new file with mode: 0644]

index 64cb011..163bee3 100644 (file)
@@ -1,5 +1,11 @@
 2011-04-28  Paolo Carlini  <paolo.carlini@oracle.com>
 
+       PR c++/48530
+       * tree.c (build_cplus_new): Check build_target_expr return
+       value for error_mark_node.
+
+2011-04-28  Paolo Carlini  <paolo.carlini@oracle.com>
+
        PR c++/48771
        * semantics.c (literal_type_p): Reference types are literal types,
        per the FDIS.
index 2f082a6..2eaa1db 100644 (file)
@@ -1,6 +1,6 @@
 /* Language-dependent node constructors for parse phase of GNU compiler.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Hacked by Michael Tiemann (tiemann@cygnus.com)
 
@@ -456,7 +456,9 @@ build_cplus_new (tree type, tree init, tsubst_flags_t complain)
     return rval;
 
   rval = build_target_expr (slot, rval, complain);
-  TARGET_EXPR_IMPLICIT_P (rval) = 1;
+
+  if (rval != error_mark_node)
+    TARGET_EXPR_IMPLICIT_P (rval) = 1;
 
   return rval;
 }
index 904848c..9891d22 100644 (file)
@@ -1,5 +1,10 @@
 2011-04-28  Paolo Carlini  <paolo.carlini@oracle.com>
 
+       PR c++/48530
+       * g++.dg/cpp0x/sfinae18.C: New.
+
+2011-04-28  Paolo Carlini  <paolo.carlini@oracle.com>
+
        PR c++/48771
        * g++.dg/ext/is_literal_type1.C: New.
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae18.C b/gcc/testsuite/g++.dg/cpp0x/sfinae18.C
new file mode 100644 (file)
index 0000000..bb54335
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/48530
+// { dg-options -std=c++0x }
+
+template<class T, 
+  class = decltype(T())
+>
+char f(int);
+
+template<class>
+char (&f(...))[2];
+
+struct DelDtor {
+  DelDtor() = default;
+  ~DelDtor() = delete;
+};
+
+static_assert(sizeof(f<DelDtor>(0)) != 1, "Error");