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

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 10 11:07:06 PST 2022


zahiraam added a comment.

In D137107#3906766 <https://reviews.llvm.org/D137107#3906766>, @rnk wrote:

> 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.

@rnk would you mind looking at the fix I am proposing for this bug? Thanks.


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

https://reviews.llvm.org/D137107



More information about the cfe-commits mailing list