public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 50324
@ 2011-09-08 12:42 Paolo Carlini
  2011-09-08 15:02 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2011-09-08 12:42 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

Hi,

seems just one of these straightforward cases where we don't propagate 
the complain argument thoroughly enough. Tested x86_64-linux.

Ok for mainline?

Thanks,
Paolo.

/////////////

[-- Attachment #2: CL_50324 --]
[-- Type: text/plain, Size: 289 bytes --]

/cp
2011-09-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50324
	* typeck2.c (digest_init_r): Call complete_type_or_maybe_complain
	instead of complete_type_or_else.

/testsuite
2011-09-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50324
	* g++.dg/cpp0x/sfinae28.C: New.

[-- Attachment #3: patch_50324 --]
[-- Type: text/plain, Size: 1700 bytes --]

Index: testsuite/g++.dg/cpp0x/sfinae28.C
===================================================================
--- testsuite/g++.dg/cpp0x/sfinae28.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/sfinae28.C	(revision 0)
@@ -0,0 +1,16 @@
+// PR c++/50324
+// { dg-options -std=c++0x }
+
+struct complete { };
+struct incomplete;
+
+template<class T> auto f(T *) -> decltype(T{}) *;
+template<class T> char f(T);
+
+int main()
+{
+  complete *p = 0;
+  static_assert(sizeof(f(p)) == sizeof(void*), "");
+  incomplete *q = 0;
+  static_assert(sizeof(f(q)) == 1u, "");
+}
Index: cp/typeck2.c
===================================================================
--- cp/typeck2.c	(revision 178685)
+++ cp/typeck2.c	(working copy)
@@ -1,7 +1,7 @@
 /* Report error messages, build initializers, and perform
    some front-end optimizations for C++ compiler.
    Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Hacked by Michael Tiemann (tiemann@cygnus.com)
 
@@ -812,8 +812,9 @@ digest_init_r (tree type, tree init, bool nested,
 
   /* We must strip the outermost array type when completing the type,
      because the its bounds might be incomplete at the moment.  */
-  if (!complete_type_or_else (TREE_CODE (type) == ARRAY_TYPE
-			      ? TREE_TYPE (type) : type, NULL_TREE))
+  if (!complete_type_or_maybe_complain (TREE_CODE (type) == ARRAY_TYPE
+					? TREE_TYPE (type) : type, NULL_TREE,
+					complain))
     return error_mark_node;
 
   /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ Patch] PR 50324
  2011-09-08 12:42 [C++ Patch] PR 50324 Paolo Carlini
@ 2011-09-08 15:02 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2011-09-08 15:02 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-patches

OK.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-08 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-08 12:42 [C++ Patch] PR 50324 Paolo Carlini
2011-09-08 15:02 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).