* Re: C++20 modules: exporting classes with virtual destructors
[not found] <72ccd83f-40a7-b21c-5a05-de6695e73f52@netskope.com>
@ 2021-11-30 16:16 ` Oleg Smolsky
2021-12-02 16:32 ` Oleg Smolsky
0 siblings, 1 reply; 2+ messages in thread
From: Oleg Smolsky @ 2021-11-30 16:16 UTC (permalink / raw)
To: gcc-help
FWIIW, this case does compile with Clang12:
/opt/llvm-12/bin/clang++ task.cpp -std=c++20 -c -o task.pcm -Xclang
-emit-module-interface
/opt/llvm-12/bin/clang++ task.cpp -std=c++20 -c -o task.o
-fprebuilt-module-path=.
/opt/llvm-12/bin/clang++ main.cpp -std=c++20 -c -o main.o
-fprebuilt-module-path=.
On Mon, Nov 29, 2021 at 4:08 PM Oleg Smolsky <osmolsky@netskope.com> wrote:
> Hi there! I'm trying to integrate C++20 modules into my project and got
> stuck on a "virtual destructor" issue. Here is a minimal reproducer
> rejected by GCC11:
>
> /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;
>
> The module is called "task" and here is its interface (task.cpp):
>
> export module task;
> #include "b.h"
> #include "d.h"
>
> b.h:
>
> #pragma once
> export struct Base {
> virtual ~Base() = default;
> void DoStuff();
> };
>
> b.cpp:
>
> module;
> #include <string>
> module task;
> void Base::DoStuff() {}
>
> The consumer is exactly what you'd imagine - "new Derived;", followed by a
> virtual call, followed by the "delete".
>
> How is this supposed to work? Is this code Standard-compliant?
>
> Thanks!
> Oleg.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: C++20 modules: exporting classes with virtual destructors
2021-11-30 16:16 ` C++20 modules: exporting classes with virtual destructors Oleg Smolsky
@ 2021-12-02 16:32 ` Oleg Smolsky
0 siblings, 0 replies; 2+ messages in thread
From: Oleg Smolsky @ 2021-12-02 16:32 UTC (permalink / raw)
To: gcc-help
Opened https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103499
On Tue, Nov 30, 2021 at 8:16 AM Oleg Smolsky <osmolsky@netskope.com> wrote:
> FWIIW, this case does compile with Clang12:
>
> /opt/llvm-12/bin/clang++ task.cpp -std=c++20 -c -o task.pcm -Xclang
> -emit-module-interface
> /opt/llvm-12/bin/clang++ task.cpp -std=c++20 -c -o task.o
> -fprebuilt-module-path=.
> /opt/llvm-12/bin/clang++ main.cpp -std=c++20 -c -o main.o
> -fprebuilt-module-path=.
>
> On Mon, Nov 29, 2021 at 4:08 PM Oleg Smolsky <osmolsky@netskope.com>
> wrote:
>
>> Hi there! I'm trying to integrate C++20 modules into my project and got
>> stuck on a "virtual destructor" issue. Here is a minimal reproducer
>> rejected by GCC11:
>>
>> /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;
>>
>> The module is called "task" and here is its interface (task.cpp):
>>
>> export module task;
>> #include "b.h"
>> #include "d.h"
>>
>> b.h:
>>
>> #pragma once
>> export struct Base {
>> virtual ~Base() = default;
>> void DoStuff();
>> };
>>
>> b.cpp:
>>
>> module;
>> #include <string>
>> module task;
>> void Base::DoStuff() {}
>>
>> The consumer is exactly what you'd imagine - "new Derived;", followed by
>> a virtual call, followed by the "delete".
>>
>> How is this supposed to work? Is this code Standard-compliant?
>>
>> Thanks!
>> Oleg.
>>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-02 16:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <72ccd83f-40a7-b21c-5a05-de6695e73f52@netskope.com>
2021-11-30 16:16 ` C++20 modules: exporting classes with virtual destructors Oleg Smolsky
2021-12-02 16:32 ` Oleg Smolsky
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).