PR c++/37290
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 8 Nov 2009 22:27:39 +0000 (22:27 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 8 Nov 2009 22:27:39 +0000 (22:27 +0000)
* pt.c (tsubst) [TYPEOF_TYPE]: Set cp_unevaluated_operand.

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

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/typeof11.C [new file with mode: 0644]

index 7dc1587..6e94fe5 100644 (file)
@@ -1,5 +1,8 @@
 2009-11-07  Jason Merrill  <jason@redhat.com>
 
+       PR c++/37290
+       * pt.c (tsubst) [TYPEOF_TYPE]: Set cp_unevaluated_operand.
+
        PR c++/18451
        PR c++/40738
        * cp-tree.h (cp_decl_specifier_seq): Add any_type_specifiers_p.
index dd453c5..6e708b3 100644 (file)
@@ -10220,10 +10220,17 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
       {
        tree type;
 
-       type = finish_typeof (tsubst_expr 
-                             (TYPEOF_TYPE_EXPR (t), args,
-                              complain, in_decl,
-                              /*integral_constant_expression_p=*/false));
+       ++cp_unevaluated_operand;
+       ++c_inhibit_evaluation_warnings;
+
+       type = tsubst_expr (TYPEOF_TYPE_EXPR (t), args,
+                           complain, in_decl,
+                           /*integral_constant_expression_p=*/false);
+
+       --cp_unevaluated_operand;
+       --c_inhibit_evaluation_warnings;
+
+       type = finish_typeof (type);
        return cp_build_qualified_type_real (type,
                                             cp_type_quals (t)
                                             | cp_type_quals (type),
index 550315a..df46adb 100644 (file)
@@ -1,3 +1,8 @@
+2009-11-07  Jason Merrill  <jason@redhat.com>
+
+       PR c++/37290
+       * g++.dg/ext/typeof11.C: New.
+
 2009-11-08  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/41985
diff --git a/gcc/testsuite/g++.dg/ext/typeof11.C b/gcc/testsuite/g++.dg/ext/typeof11.C
new file mode 100644 (file)
index 0000000..2e4e46c
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/37290
+
+template<typename T> T& ensure_obj(const T&);
+template <typename T>
+void func2(T& t)
+{
+  typedef __typeof__(ensure_obj(t)) ttt;
+  struct ttt1
+  {
+    ttt1( ttt arg0 ){}
+  }  tttt ( t );
+}
+int main()
+{
+  double d = 5;
+  func2(d);
+}
+