OSDN Git Service

PR c++/38795
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 13 Jan 2009 18:11:50 +0000 (18:11 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 13 Jan 2009 18:11:50 +0000 (18:11 +0000)
* tree.c (cp_walk_subtrees): Handle REINTERPRET_CAST_EXPR,
STATIC_CAST_EXPR, CONST_CAST_EXPR and DYNAMIC_CAST_EXPR the same
as CAST_EXPR.

* g++.dg/cpp0x/pr38795.C: New test.

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

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr38795.C [new file with mode: 0644]

index 7e35ecd..12c07ee 100644 (file)
@@ -1,3 +1,10 @@
+2009-01-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/38795
+       * tree.c (cp_walk_subtrees): Handle REINTERPRET_CAST_EXPR,
+       STATIC_CAST_EXPR, CONST_CAST_EXPR and DYNAMIC_CAST_EXPR the same
+       as CAST_EXPR.
+
 2009-01-12  Jason Merrill  <jason@redhat.com>
            Steve Ellcey  <sje@cup.hp.com>
 
index ad84cc8..8ac2720 100644 (file)
@@ -1,6 +1,6 @@
 /* Language-dependent node constructors for parse phase of GNU compiler.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Hacked by Michael Tiemann (tiemann@cygnus.com)
 
@@ -2443,6 +2443,10 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
       break;
 
     case CAST_EXPR:
+    case REINTERPRET_CAST_EXPR:
+    case STATIC_CAST_EXPR:
+    case CONST_CAST_EXPR:
+    case DYNAMIC_CAST_EXPR:
       if (TREE_TYPE (*tp))
        WALK_SUBTREE (TREE_TYPE (*tp));
 
index 37223ec..18f15ca 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/38795
+       * g++.dg/cpp0x/pr38795.C: New test.
+
 2009-01-13  Daniel Jacobowitz  <dan@codesourcery.com>
            Nathan Froyd  <froydnj@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr38795.C b/gcc/testsuite/g++.dg/cpp0x/pr38795.C
new file mode 100644 (file)
index 0000000..54fb361
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/38795
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+template<typename... T> int foo(int i)
+{
+  return *reinterpret_cast<T*>(i);     // { dg-error "not expanded with|T" }
+}
+
+void bar(int i)
+{
+  foo<int>(i);
+}