OSDN Git Service

PR lto/45959
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Oct 2010 13:25:37 +0000 (13:25 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Oct 2010 13:25:37 +0000 (13:25 +0000)
PR lto/45960
* pt.c (tsubst_copy) [INTEGER_CST]: Instantiate the type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165306 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lto/20101010-1_0.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lto/20101010-2_0.C [new file with mode: 0644]

index 9928f61..0bf00e7 100644 (file)
@@ -1,3 +1,9 @@
+2010-10-10  Jason Merrill  <jason@redhat.com>
+
+       PR lto/45959
+       PR lto/45960
+       * pt.c (tsubst_copy) [INTEGER_CST]: Instantiate the type.
+
 2010-10-07  Andi Kleen  <ak@linux.intel.com>
 
        * Make-lang.in (c++_OBJS): Remove dummy-checksum.o.
index 9afa74d..b84cc78 100644 (file)
@@ -11373,6 +11373,17 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
       error ("use %<...%> to expand argument pack");
       return error_mark_node;
 
+    case INTEGER_CST:
+    case REAL_CST:
+    case STRING_CST:
+      {
+       /* Instantiate any typedefs in the type.  */
+       tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
+       r = fold_convert (type, t);
+       gcc_assert (TREE_CODE (r) == code);
+       return r;
+      }
+
     default:
       return t;
     }
index 315e688..c6ab6da 100644 (file)
@@ -1,3 +1,8 @@
+2010-10-10  Richard Guenther  <rguenther@suse.de>
+
+       * g++.dg/lto/20101010-1_0.C: New testcase.
+       * g++.dg/lto/20101010-2_0.C: Likewise.
+
 2010-10-11  Ira Rosen  <irar@il.ibm.com>
 
        PR tree-optimization/45902
diff --git a/gcc/testsuite/g++.dg/lto/20101010-1_0.C b/gcc/testsuite/g++.dg/lto/20101010-1_0.C
new file mode 100644 (file)
index 0000000..6eb40ef
--- /dev/null
@@ -0,0 +1,109 @@
+// { dg-lto-do link }
+
+typedef long size_t;
+template < class, class > struct pair
+{
+}
+;
+template < typename > class allocator;
+template < typename > struct equal_to;
+
+template < class > struct hash;
+template
+<
+class, class, class, class, class, class > struct dense_hashtable_iterator;
+template
+<
+class,
+    class, class, class, class, class > struct dense_hashtable_const_iterator;
+template
+<
+class
+Value,
+    class
+    Key,
+    class
+    HashFcn,
+    class ExtractKey, class EqualKey, class Alloc > class dense_hashtable
+{
+public:
+    typedef Key key_type;
+    typedef Value value_type;
+    typedef size_t size_type;
+    typedef
+       dense_hashtable_iterator
+       < Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > iterator;
+    typedef
+       dense_hashtable_const_iterator
+       < Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > const_iterator;
+    static const size_type ILLEGAL_BUCKET = (-1);
+    pair < size_type, size_type > find_position (key_type)
+      {
+       size_type insert_pos = ILLEGAL_BUCKET;
+      }
+    pair < iterator, bool > insert_noresize (value_type obj)
+      {
+       pair < size_type, size_type > pos = find_position ((obj));
+      }
+    pair < iterator, bool > insert (value_type & obj)
+      {
+       insert_noresize (obj);
+      }
+    ExtractKey get_key;
+}
+
+;
+template
+<
+class
+Value,
+    class
+    HashFcn
+    =
+    hash
+    <
+    Value
+    >,
+    class
+    EqualKey
+    =
+    equal_to < Value >, class Alloc = allocator < Value > >class dense_hash_set
+{
+  struct Identity
+    {
+    }
+  ;
+  typedef
+      dense_hashtable < Value, Value, HashFcn, Identity, EqualKey, Alloc > ht;
+  ht rep;
+public:
+  typedef typename ht::value_type value_type;
+  typedef typename ht::const_iterator iterator;
+  pair < iterator, bool > insert (value_type obj)
+    {
+      pair < typename ht::iterator, bool > p = rep.insert (obj);
+    }
+}
+
+;
+class blah_46
+{
+}
+;
+struct foo_10:dense_hash_set < blah_46 >
+{
+}
+;
+class foo_14
+{
+  void hmmmmh_5 (blah_46);
+  foo_10 negative_rrrrrrr_type_data_;
+}
+;
+void
+foo_14::hmmmmh_5 (blah_46 hahaha_id)
+{
+  negative_rrrrrrr_type_data_.insert (hahaha_id);
+}
+
+int main () { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20101010-2_0.C b/gcc/testsuite/g++.dg/lto/20101010-2_0.C
new file mode 100644 (file)
index 0000000..c68bcd6
--- /dev/null
@@ -0,0 +1,32 @@
+// { dg-lto-do link }
+
+typedef int size_t;
+template < size_t _Nw > struct _Base_bitset
+{
+  typedef unsigned _WordT;
+  _WordT _M_w[_Nw];
+  void _M_do_set ()
+  {
+    for (size_t __i;;)
+      _M_w[__i] = static_cast < _WordT > (0);
+  }
+};
+
+template < size_t > class bitset:
+_Base_bitset < ((sizeof (unsigned)) + ((sizeof (unsigned)) ? : 1)) >
+{
+public:
+  bitset set ()
+  {
+    _M_do_set ();
+  }
+};
+
+void
+test01 ()
+{
+  bitset < 96 > z6;
+  z6.set ();
+}
+
+int main() { return 0; }