| Issue |
165668
|
| Summary |
clang-cl fails to compile dllexported class with std::vector of forward-declared nested type when using /std:c++20 compiler flag
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
developer6454
|
Hi,
The following program compiles successfully with the MSVC cl compiler, but fails to compile with clang-cl, even when the /clang:-fms-compatibility flag is specified.
`> clang-cl.exe -c test.cpp /std:c++20 /clang:-fms-compatibility `
```
#include <vector>
struct __declspec(dllexport) Foo {
class NestedFoo; // Forward declaration
std::vector<NestedFoo> v;
};
// Define the NestedFoo
struct __declspec(dllexport) Foo::NestedFoo {
int i ;
};
```
**Error:**
```
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.36.32532\include\vector(683,78): error: arithmetic on a pointer to an incomplete type 'value_type' (aka 'Foo::NestedFoo')
683 | const auto _Count = static_cast<size_type>(_Right_data._Mylast - _Right_data._Myfirst);
|
```
```
> clang-cl.exe --version
clang version 21.1.1
Target: x86_64-pc-windows-msvc
Thread model: posix
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs