OSDN Git Service

Backported from mainline
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Apr 2013 17:58:29 +0000 (17:58 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Apr 2013 17:58:29 +0000 (17:58 +0000)
2012-10-08  Jakub Jelinek  <jakub@redhat.com>

PR c++/54858
* tree.c (cp_tree_equal): Handle FIELD_DECL.

* g++.dg/template/pr54858.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@197445 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 5a4d95f..1808b9d 100644 (file)
@@ -1,3 +1,11 @@
+2013-04-03  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2012-10-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/54858
+       * tree.c (cp_tree_equal): Handle FIELD_DECL.
+
 2013-03-14  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/56403
index 0ff576a..3d55aea 100644 (file)
@@ -2265,6 +2265,7 @@ cp_tree_equal (tree t1, tree t2)
 
     case VAR_DECL:
     case CONST_DECL:
+    case FIELD_DECL:
     case FUNCTION_DECL:
     case TEMPLATE_DECL:
     case IDENTIFIER_NODE:
index 99e28b1..43de522 100644 (file)
@@ -1,6 +1,11 @@
 2013-04-03  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2012-10-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/54858
+       * g++.dg/template/pr54858.C: New test.
+
        2012-09-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/54486
diff --git a/gcc/testsuite/g++.dg/template/pr54858.C b/gcc/testsuite/g++.dg/template/pr54858.C
new file mode 100644 (file)
index 0000000..51610ad
--- /dev/null
@@ -0,0 +1,21 @@
+// PR c++/54858
+// { dg-do compile }
+
+template <int> struct A {};
+template <typename T, T *> struct B {};
+template <typename D> struct C
+{
+  A<0> c0; B<A<0>, &C::c0> d0; // { dg-error "could not convert template argument" }
+  A<0> c1; B<A<0>, &C::c1> d1; // { dg-error "could not convert template argument" }
+  A<0> c2; B<A<0>, &C::c2> d2; // { dg-error "could not convert template argument" }
+  A<0> c3; B<A<0>, &C::c3> d3; // { dg-error "could not convert template argument" }
+  A<0> c4; B<A<0>, &C::c4> d4; // { dg-error "could not convert template argument" }
+  A<0> c5; B<A<0>, &C::c5> d5; // { dg-error "could not convert template argument" }
+  A<0> c6; B<A<0>, &C::c6> d6; // { dg-error "could not convert template argument" }
+  A<0> c7; B<A<0>, &C::c7> d7; // { dg-error "could not convert template argument" }
+  A<0> c8; B<A<0>, &C::c8> d8; // { dg-error "could not convert template argument" }
+  A<0> c9; B<A<0>, &C::c9> d9; // { dg-error "could not convert template argument" }
+  A<0> ca; B<A<0>, &C::ca> da; // { dg-error "could not convert template argument" }
+  A<0> cb; B<A<0>, &C::cb> db; // { dg-error "could not convert template argument" }
+};
+C<int> e;