]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/42353 ([OOP] Bogus Error: Name 'vtype$...' at (1) is an ambiguous refer...
authorJanus Weil <janus@gcc.gnu.org>
Mon, 28 Dec 2009 23:13:03 +0000 (00:13 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Mon, 28 Dec 2009 23:13:03 +0000 (00:13 +0100)
gcc/fortran/
2009-12-28 Janus Weil  <janus@gcc.gnu.org>

PR fortran/42353
* symbol.c (gfc_find_derived_vtab): Make vtabs and vtypes private.

gcc/testsuite/
2009-12-28  Janus Weil  <janus@gcc.gnu.org>

PR fortran/42353
* gfortran.dg/class_13.f03: New test.

From-SVN: r155494

gcc/fortran/ChangeLog
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/class_13.f03 [new file with mode: 0644]

index 0f2ecc7e8db26c5ed0cf65290afcdf7ee208f98a..55fc753409924fd4afca2a526647a4cae1ac2f9f 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-28 Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/42353
+       * symbol.c (gfc_find_derived_vtab): Make vtabs and vtypes private.
+
 2009-12-27  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
            Daniel Kraft  <d@domob.eu>
 
index 1b40d9a549acaa4c6a78962a16d078d907062624..8ba5adb51c2090fd1d944c7cdaea713734d04725 100644 (file)
@@ -4748,6 +4748,7 @@ gfc_find_derived_vtab (gfc_symbol *derived)
          vtab->attr.target = 1;
          vtab->attr.save = SAVE_EXPLICIT;
          vtab->attr.vtab = 1;
+         vtab->attr.access = ACCESS_PRIVATE;
          vtab->refs++;
          gfc_set_sym_referenced (vtab);
          sprintf (name, "vtype$%s", derived->name);
@@ -4764,6 +4765,7 @@ gfc_find_derived_vtab (gfc_symbol *derived)
                return NULL;
              vtype->refs++;
              gfc_set_sym_referenced (vtype);
+             vtype->attr.access = ACCESS_PRIVATE;
 
              /* Add component '$hash'.  */
              if (gfc_add_component (vtype, "$hash", &c) == FAILURE)
index b92799fe4d215973d1bddc4f553196f57f5a3a05..aef38ad70f5135fd473e775ea2956859087a4c2f 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-28  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/42353
+       * gfortran.dg/class_13.f03: New test.
+
 2009-12-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR middle-end/41344
diff --git a/gcc/testsuite/gfortran.dg/class_13.f03 b/gcc/testsuite/gfortran.dg/class_13.f03
new file mode 100644 (file)
index 0000000..84073bf
--- /dev/null
@@ -0,0 +1,37 @@
+! { dg-do compile }
+!
+! PR 42353: [OOP] Bogus Error: Name 'vtype$...' at (1) is an ambiguous reference ...
+!
+! Original test case by Harald Anlauf <anlauf@gmx.de>
+! Modified by Janus Weil <janus@gcc.gnu.org>
+
+module concrete_vector
+  type :: trivial_vector_type
+  end type
+  class(trivial_vector_type), pointer :: this
+end module concrete_vector
+
+module concrete_gradient
+contains
+  subroutine my_to_vector (v)
+    use concrete_vector
+    class(trivial_vector_type) :: v
+    select type (v)
+    class is (trivial_vector_type)
+    end select
+  end subroutine
+end module concrete_gradient
+
+module concrete_inner_product
+  use concrete_vector
+  use concrete_gradient
+contains
+  real function my_dot_v_v (a)
+    class(trivial_vector_type) :: a
+    select type (a)
+    class is (trivial_vector_type)
+    end select
+  end function
+end module concrete_inner_product
+! { dg-final { cleanup-modules "concrete_vector concrete_gradient concrete_inner_product" } }