Commit 2d49bd6e by Paolo Carlini Committed by Paolo Carlini

re PR c++/50324 ([C++0x] SFINAE does not handle the object creation of an incomplete type)

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

From-SVN: r178694
parent 3797cb21
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.
2011-09-08 Dodji Seketeli <dodji@redhat.com>
PR c++/33255 - Support -Wunused-local-typedefs warning
......
/* 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, int flags,
/* 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
......
2011-09-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50324
* g++.dg/cpp0x/sfinae28.C: New.
2011-09-08 Dodji Seketeli <dodji@redhat.com>
PR c++/33255 - Support -Wunused-local-typedefs warning
......
// 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, "");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment