Even if the reference itself is dllexport, the temporary should not be -- in fact, we're already giving it internal linkage, so dllexporting it is not just wasteful, but will fail to link, as in the example below:
$ cat /tmp/a.cc void _DllMainCRTStartup() {} const int __declspec(dllexport) &foo = 42; $ clang-cl -fuse-ld=lld /tmp/a.cc /Zl /link /dll /out:a.dll lld-link: error: <root>: undefined symbol: int const &foo::$RT1