diff mbox

[C++,committed] PR 48530 (again)

Message ID 4DB93991.6000409@oracle.com
State New
Headers show

Commit Message

Paolo Carlini April 28, 2011, 9:55 a.m. UTC
Hi,

tested x86_64-linux, committed to mainline.

Paolo.

////////////////////
/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.
diff mbox

Patch

Index: testsuite/g++.dg/cpp0x/sfinae18.C
===================================================================
--- testsuite/g++.dg/cpp0x/sfinae18.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/sfinae18.C	(revision 0)
@@ -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");
Index: cp/tree.c
===================================================================
--- cp/tree.c	(revision 173061)
+++ cp/tree.c	(working copy)
@@ -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,8 +456,10 @@  build_cplus_new (tree type, tree init, tsubst_flag
     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;
 }