public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "oleg at smolsky dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/103499] New: C++20 modules error: invalid use of non-static member function
Date: Tue, 30 Nov 2021 16:35:07 +0000	[thread overview]
Message-ID: <bug-103499-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103499

            Bug ID: 103499
           Summary: C++20 modules error: invalid use of non-static member
                    function
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: oleg at smolsky dot net
  Target Milestone: ---

There seems to be a bug when exporting a class hierarchy from a module. Here is
the GCC11 output:

/opt/gcc-11/bin/g++ -std=c++20 -fmodules-ts -c -o main.o main.cpp
main.cpp: In function ‘int main()’:
main.cpp:6:12: error: invalid use of non-static member function ‘virtual
Derived@task::~Derived()’
    6 |     delete p;

$ cat task.cpp
export module task;

#include "b.h"
#include "d.h"

$ cat b.h
#pragma once

export struct Base {
  virtual ~Base() = default;

  void DoStuff();
};

$ cat d.h
#include "b.h"

export struct Derived : Base {
  ~Derived();
};

$ cat main.cpp
import task;

int main() {
    auto p = new Derived;
    p->DoStuff();
    delete p;
}

             reply	other threads:[~2021-11-30 16:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 16:35 oleg at smolsky dot net [this message]
2022-09-02 20:28 ` [Bug c++/103499] " markmigm at gmail dot com
2022-09-03 20:43 ` markmigm at gmail dot com
2022-09-08  4:58 ` markmigm at gmail dot com
2023-06-02 19:27 ` pinskia at gcc dot gnu.org
2023-06-05  8:38 ` redi at gcc dot gnu.org
2023-06-05 13:44 ` markmigm at gmail dot com
2023-11-14 19:43 ` cvs-commit at gcc dot gnu.org
2024-02-10  4:32 ` nshead at gcc dot gnu.org
2024-03-08 16:03 ` ppalka 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-103499-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: link
Be 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).