[PATCH] D137107: Allow MS extension: support of constexpr with __declspec(dllimport).

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 3 16:15:53 PDT 2022


rnk added a comment.

In D137107#3905443 <https://reviews.llvm.org/D137107#3905443>, @zahiraam wrote:

>   extern int __declspec(dllimport) next(int n);
>   int main () {
>     extern int _declspec(dllimport) val;
>     constexpr int& val_ref = val;
>     int i = next(val_ref);
>     return i;
>   } 
>
> @rnk Shouldn't this run?

Yes, I agree, this is a bug. Clang should compile this and reference `__imp_next` here. However, Clang should continue producing errors when a dllimport symbol is used to initialize a constexpr global variable, which was one of the other cases mentioned in the initial report.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137107/new/

https://reviews.llvm.org/D137107



More information about the cfe-commits mailing list