public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "everythingfunctional at protonmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/102109] New: Associate to construct compound object results in incorrect type inferred Date: Fri, 27 Aug 2021 21:37:22 +0000 [thread overview] Message-ID: <bug-102109-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102109 Bug ID: 102109 Summary: Associate to construct compound object results in incorrect type inferred Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: everythingfunctional at protonmail dot com Target Milestone: --- Using version Ubuntu 11.1.0-1ubuntu1~21.04 on Pop!OS Using nested associate constructs to construct a compound object of derived type results in the compiler rejecting the code with what it thinks is a type mismatch. Example code below program main type :: sub_obj_t integer :: val end type type :: compound_obj_t type(sub_obj_t) :: sub_obj end type associate(initial_sub_obj => sub_obj_t(42)) associate(obj => compound_obj_t(initial_sub_obj)) print *, obj%sub_obj%val end associate end associate end program app/main.f90:11:40: 11 | associate(obj => compound_obj_t(initial_sub_obj)) | 1 Error: Cannot convert INTEGER(4) to TYPE(sub_obj_t) at (1) Note: for a fun twist, if you remove the print statement, this does compile and run.
next reply other threads:[~2021-08-27 21:37 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-27 21:37 everythingfunctional at protonmail dot com [this message] 2023-06-01 8:13 ` [Bug fortran/102109] " pault at gcc dot gnu.org 2023-06-02 7:41 ` cvs-commit at gcc dot gnu.org 2023-06-02 8:39 ` pault at gcc dot gnu.org 2023-06-02 8:41 ` pault at gcc dot gnu.org 2023-08-27 8:51 ` cvs-commit at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-102109-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).