mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-24 03:14:08 +08:00
re PR fortran/47572 ([OOP] Invalid: Allocatable polymorphic with init expression.)
2011-02-02 Janus Weil <janus@gcc.gnu.org> PR fortran/47572 * resolve.c (resolve_fl_variable): Handle polymorphic allocatables. 2011-02-02 Janus Weil <janus@gcc.gnu.org> PR fortran/47572 * gfortran.dg/class_36.f03: New. From-SVN: r169520
This commit is contained in:
parent
5cbf5c20cf
commit
da285ce8e4
@ -1,3 +1,8 @@
|
||||
2011-02-02 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/47572
|
||||
* resolve.c (resolve_fl_variable): Handle polymorphic allocatables.
|
||||
|
||||
2011-02-01 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/47565
|
||||
|
@ -10063,7 +10063,8 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag)
|
||||
/* Reject illegal initializers. */
|
||||
if (!sym->mark && sym->value)
|
||||
{
|
||||
if (sym->attr.allocatable)
|
||||
if (sym->attr.allocatable || (sym->ts.type == BT_CLASS
|
||||
&& CLASS_DATA (sym)->attr.allocatable))
|
||||
gfc_error ("Allocatable '%s' at %L cannot have an initializer",
|
||||
sym->name, &sym->declared_at);
|
||||
else if (sym->attr.external)
|
||||
|
@ -1,3 +1,8 @@
|
||||
2011-02-02 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/47572
|
||||
* gfortran.dg/class_36.f03: New.
|
||||
|
||||
2011-02-02 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/47566
|
||||
|
14
gcc/testsuite/gfortran.dg/class_36.f03
Normal file
14
gcc/testsuite/gfortran.dg/class_36.f03
Normal file
@ -0,0 +1,14 @@
|
||||
! { dg-do compile }
|
||||
!
|
||||
! PR 47572: [OOP] Invalid: Allocatable polymorphic with init expression.
|
||||
!
|
||||
! Contributed by Edmondo Giovannozzi <edmondo.giovannozzi@gmail.com>
|
||||
! cf. http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/763785b16883ed68
|
||||
|
||||
program scalar_allocation
|
||||
type test
|
||||
real :: a
|
||||
end type
|
||||
class (test), allocatable :: b = test(3.4) ! { dg-error "cannot have an initializer" }
|
||||
print *,allocated(b)
|
||||
end program
|
Loading…
Reference in New Issue
Block a user