From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15383 invoked by alias); 16 Jun 2011 20:36:22 -0000 Received: (qmail 15320 invoked by uid 22791); 16 Jun 2011 20:36:21 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Jun 2011 20:36:07 +0000 From: "neil.n.carlson at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/49213] [OOP] gfortran rejects structure constructor expression X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: neil.n.carlson at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 16 Jun 2011 20:36:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg01491.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49213 --- Comment #3 from neil.n.carlson at gmail dot com 2011-06-16 20:35:48 UTC --- (In reply to comment #1) > Note: Intrinsic assignments to polymorphic variables are forbidden [...] This was really about the structure constructor; the assignment was just to do something with the value, so the example was poor. Here's a slightly different version that gets to the heart of what I intended: program main type :: S integer :: n end type type(S) :: Sobj type, extends(S) :: S2 integer :: m end type type(S2) :: S2obj type :: T class(S), allocatable :: x end type Sobj = S(1) call pass_it (T(Sobj)) S2obj = S2(1,2) call pass_it (T(S2obj)) contains subroutine pass_it (foo) type(T), intent(in) :: foo end subroutine end program This gives the same errors: call pass_it (T(Sobj)) 1 Error: Can't convert TYPE(s) to CLASS(s) at (1) call pass_it (T(S2obj)) 1 Error: Can't convert TYPE(s2) to CLASS(s) at (1)