From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63537 invoked by alias); 3 Jun 2015 20:06:16 -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 Received: (qmail 63508 invoked by uid 48); 3 Jun 2015 20:06:12 -0000 From: "cmacmackin at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/66409] New: Reporting ambiguous interface when overloading assignment with polymorphic array Date: Wed, 03 Jun 2015 20:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cmacmackin at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-06/txt/msg00365.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66409 Bug ID: 66409 Summary: Reporting ambiguous interface when overloading assignment with polymorphic array Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: cmacmackin at gmail dot com Target Milestone: --- I have come across what I believe to be a bug (or possibly a misunderstanding of the standard on one of our counts) in gfortran. I'm trying to overload the assignment operator with two custom procedures: module container_mod interface assignment(=) module procedure assign_to_variable module procedure assign_to_variable_1d end interface contains subroutine assign_to_variable (retval,input) class(*), intent(inout) :: retval real, intent(in) :: input return end subroutine assign_to_variable subroutine assign_to_variable_1d (retval_1d,input) class(*), dimension(:), intent(inout) :: retval_1d real, intent(in) :: input return end subroutine assign_to_variable_1d end module container_mod (In the real program where I do this, the input variable is a derived type.) However, I am getting the compile-time error gfortran -Wall -c "dbg.f90" dbg.f90:5.46: module procedure assign_to_variable_1d 1 Error: Ambiguous interfaces 'assign_to_variable_1d' and 'assign_to_variable' in intrinsic assignment operator at (1) I've found that ifort 12.1.7.367 and pgfortran 8.0-6 both compile this just fine. I've also found that, if I change the interface from assignment to just a normal generic interface, it compiles properly. Finally, if I change the unlimited polymorphic variables to anything else (a built-in variable type, a derived type, or a non-unlimited polymorphic variable) it compiled without problems. It's also worth noting that, if I try to compile this with only the scalar interface, gfortran complains when I try to use that to assign to an array. So obviously the interface is not ambiguous when it comes to actually performing the assignment. I hope all of that's clear. I'll be happy to answer any questions or clarifications.