[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [llvm-bugs] [Bug 90620] [C++20] [Modules] Cannot export type_info/operator new/operator delete
From:       LLVM Bugs via llvm-bugs <llvm-bugs () lists ! llvm ! org>
Date:       2024-04-30 14:53:19
Message-ID: 20240430145319.7d6526c9370864f1 () email ! llvm ! org
[Download RAW message or body]

[Attachment #2 (text/html)]

<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/90620>90620</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [C++20] [Modules] Cannot export type_info/operator new/operator delete
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          huangqinjin
      </td>
    </tr>
</table>

<pre>
    #### `test.cppm`

```c++
module;

#include &lt;stddef.h&gt;

export module test;

extern &quot;C++&quot;
{
    export class type_info;                                 // 0

    export void* operator new(size_t);                      // 1
    export void* operator new[](size_t);                    // 2
    export void operator delete(void*) noexcept;            // 3
    export void operator delete[](void*) noexcept;          // 4

    export void operator delete(void*, size_t) noexcept;    // 5
    export void operator delete[](void*, size_t) noexcept;  // 6
}
```

#### targeting x86_64-linux-gnu
```shell
✗ clang --target=x86_64-linux-gnu -std=c++20 --precompile test.cppm
test.cppm:11:18: error: cannot export redeclaration &apos;operator new&apos; here \
since the previous declaration is not exported  11 |     export void* operator \
new(size_t);                      // 1  |                  ^
note: previous declaration is here
test.cppm:12:18: error: cannot export redeclaration &apos;operator new[]&apos; here \
since the previous declaration is not exported  12 |     export void* operator \
new[](size_t);                    // 2  |                  ^
note: previous declaration is here
test.cppm:13:17: error: cannot export redeclaration &apos;operator delete&apos; here \
since the previous declaration is not exported  13 |     export void operator \
delete(void*) noexcept;            // 3  |                 ^
note: previous declaration is here
test.cppm:14:17: error: cannot export redeclaration &apos;operator delete[]&apos; \
here since the previous declaration is not exported  14 |     export void operator \
delete[](void*) noexcept;          // 4  |                 ^
note: previous declaration is here
4 errors generated.
```

#### targeting x86_64-windows-msvc
```shell
✗ clang --target=x86_64-windows-msvc -std=c++20 --precompile test.cppm
test.cppm:9:18: error: cannot export redeclaration &apos;type_info&apos; here since \
the previous declaration is not exported  9 |     export class type_info;             \
// 0  |                  ^
note: previous declaration is here
test.cppm:11:18: error: cannot export redeclaration &apos;operator new&apos; here \
since the previous declaration is not exported  11 |     export void* operator \
new(size_t);                      // 1  |                  ^
note: previous declaration is here
test.cppm:12:18: error: cannot export redeclaration &apos;operator new[]&apos; here \
since the previous declaration is not exported  12 |     export void* operator \
new[](size_t);                    // 2  |                  ^
note: previous declaration is here
test.cppm:13:17: error: cannot export redeclaration &apos;operator delete&apos; here \
since the previous declaration is not exported  13 |     export void operator \
delete(void*) noexcept;            // 3  |                 ^
note: previous declaration is here
test.cppm:14:17: error: cannot export redeclaration &apos;operator delete[]&apos; \
here since the previous declaration is not exported  14 |     export void operator \
delete[](void*) noexcept;          // 4  |                 ^
note: previous declaration is here
5 errors generated.
```

The strange thing is that other overloads of `operator new` and `operator delete` can \
be exported without error. </pre>
<img width="1px" height="1px" alt="" \
src="http://email.email.llvm.org/o/eJzsmEuzojgUxz9N2JzCgoTngoWPdje72XdFcoR0YcIkQe359FN \
ofNa93bbeu5m6FoUSwi8n_5wHhlsrG4VYkXRG0kXAB9dqU7UDV80_Uv2QKlhp8bMilJ0PIFnk0LpJ3fcbkkUkW \
pBo6s9ZdDxqQmfjcWjdaDF0SNjspitlUtXdIBAIm1snBK4nLWHfrjvhvtfGwREA46h3FNw7NAoIpXM_IqX-fu4 \
7AgB4Tt1xa8H97PG7VGtN2Ax-9yF0SegSbmZ5RdxqKQidgu7RcKcNKNwRWlj5L353hJbvDuG58WPEw-o8wPVU- \
ib1ghTYoUNCCz8YoSUojfsae3dH9kT2GPFk5--4npr8QtVfWTuHsxD3fE9On7T3XbLnZifnWtw5_J1rX6LFcdO \
gk6qBfZF9z5Kwk2rYh40a7gi2xa7zbd8oKeekzEePVQ2E4ZFC2OIeAqF1grCFDzgaQRj2Bmu96aUPmWOgHsCXS \
zaN4_FUEDYFNEab8UfNldLuJJlBgXXHDXdSjzGW33p5Di0aBCtVjeBahN7gVurBwvVj0sIFieK8LnEMJJ_D58Q \
SnNm3HVOfXZR2OM73PYvHib2hGH1NMe9tL-pGH9Lt-YzxSdqx8ZQ_pd0pAbwoHHtLuA9Kim-L9qpmycuafYzLJ \
Q8p91zy_1D1kqNQFhpUo3EoJk_n6Z1UQu9suLHb-pVUfc15PluXf5x6Lq85Ly4_lPfL__J71Cfmma-q9lXVvqr \
aV1X7H1W19I-q2t8tgnWGq2YUZSxo0oJruQPtWjSgt2g6zYUFvR7_y98EWBYBV-Km2euQReMqwQrPSsJOulYP7 \
mjdJBAVEyUreYBVnMdJUhR5WQZthUmcc77Gok5wVcRcJMUqquMki4Rg2ToPZEUjmkQJi-IkZXE5yUWW0qwuWR4 \
VWbKOSRLhhstu0nXbzUSbJpDWDliVUUajoOMr7OxhC4NShTs43CSUknQRmGp8JlwNjSVJ1Enr7IXipOsOex_zU \
z0m6QJIOvvrsOFgx6v5jWteFdXlbUZf3gkWDKarWud6S9j06ByNdO2wmtR6Q-hyNMJ_hb3RP7B2hC4PpltCl4ep_RcAAP__JZ0_sQ">



[Attachment #3 (text/plain)]

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic