complain &= ~tf_error;
/* Call reshape_init early to remove redundant braces. */
- if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)
- && CLASS_TYPE_P (to)
- && COMPLETE_TYPE_P (complete_type (to))
- && !CLASSTYPE_NON_AGGREGATE (to))
+ if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr) && CLASS_TYPE_P (to))
{
- expr = reshape_init (to, expr, complain);
- if (expr == error_mark_node)
- return NULL;
- from = TREE_TYPE (expr);
+ to = complete_type (to);
+ if (!COMPLETE_TYPE_P (to))
+ return nullptr;
+ if (!CLASSTYPE_NON_AGGREGATE (to))
+ {
+ expr = reshape_init (to, expr, complain);
+ if (expr == error_mark_node)
+ return nullptr;
+ from = TREE_TYPE (expr);
+ }
}
if (TYPE_REF_P (to))
// { dg-do compile { target c++11 } }
namespace std {
-template <class> class initializer_list; // { dg-message "declaration" }
+template <class> class initializer_list;
}
template <typename T> struct B { B (std::initializer_list<T>); };
struct C { virtual int foo (); };
-struct D : C {} d { B<C> { D {} } }; // { dg-error "incomplete|no matching" }
+struct D : C {} d { B<C> { D {} } }; // { dg-error "no matching" }