primary.c (gfc_match_structure_constructor): Allow constructor for types without components.

2007-11-22  Tobias Burnus  <burnus@net-b.de>

        * primary.c (gfc_match_structure_constructor): Allow
        constructor for types without components.

2007-11-22  Tobias Burnus  <burnus@net-b.de>

        * gfortran.dg/derived_constructor_comps_3.f90: New.

From-SVN: r130358
This commit is contained in:
Tobias Burnus 2007-11-22 22:40:22 +01:00 committed by Tobias Burnus
parent cd9a21ca0b
commit d4d757e6b5
4 changed files with 32 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2007-11-22 Tobias Burnus <burnus@net-b.de>
* primary.c (gfc_match_structure_constructor): Allow
constructor for types without components.
2007-11-22 Tobias Burnus <burnus@net-b.de>
PR fortran/34079

View file

@ -1979,7 +1979,7 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result)
if (gfc_match_char (')') != MATCH_YES)
goto syntax;
if (comp->next != NULL)
if (comp && comp->next != NULL)
{
gfc_error ("Too few components in structure constructor at %C");
goto cleanup;

View file

@ -1,3 +1,7 @@
2007-11-22 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/derived_constructor_comps_3.f90: New.
2007-11-22 Jakub Jelinek <jakub@redhat.com>
PR c++/34094

View file

@ -0,0 +1,22 @@
! { dg-compile }
!
! gfortran was ICEing for the constructor of
! componentfree types.
!
! Contributed by James Van Buskirk
! http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/c8dd08d6da052499/
!
module bug4_mod
implicit none
type bug4 ! no components
end type bug4
end module bug4_mod
program bug4_structure
use bug4_mod
implicit none
type(bug4) t
t = bug4()
write(*,*) t
end program bug4_structure
! { dg-final { cleanup-modules "bug4_mod" } }