+2013-05-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/57325
+ * tree.c (build_cplus_array_type): Copy layout info if element
+ type is complete.
+
2013-05-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/23608
if (TYPE_MAIN_VARIANT (t) != m)
{
- if (COMPLETE_TYPE_P (t) && !COMPLETE_TYPE_P (m))
+ if (COMPLETE_TYPE_P (TREE_TYPE (t)) && !COMPLETE_TYPE_P (m))
{
/* m was built before the element type was complete, so we
- also need to copy the layout info from t. */
+ also need to copy the layout info from t. We might
+ end up doing this multiple times if t is an array of
+ unknown bound. */
tree size = TYPE_SIZE (t);
tree size_unit = TYPE_SIZE_UNIT (t);
unsigned int align = TYPE_ALIGN (t);
--- /dev/null
+// PR c++/57325
+
+class valarray { int _M_data; };
+template < typename > struct SimpleJet { valarray partials; };
+
+template < class C > struct scoped_ptr_impl
+{
+ scoped_ptr_impl (C *):data_ () { }
+ struct Data
+ {
+ C ptr;
+ };
+ Data data_;
+};
+
+template < class, class = int >struct scoped_ptr;
+template < class C, class D > struct scoped_ptr <C[], D >
+{
+ scoped_ptr ():impl_ (0) { }
+ scoped_ptr_impl < C > impl_;
+};
+
+template < typename JetsT > void
+TestJets (JetsT *)
+{
+ typedef typename JetsT::JetType JetT;
+ scoped_ptr < JetT[] > a;
+}
+
+template < typename T > struct SimpleJets
+{
+ typedef SimpleJet < T > JetType;
+ scoped_ptr < SimpleJet < T >[] > vars_;
+};
+
+void fn ()
+{
+ SimpleJets < double >b;
+ TestJets (&b);
+}