__uuidof() in C++17 causes compile error on clang-cl |
|||
Issue descriptionclang-cl fails to handle __uuidof() value on a template parameter on C++17 mode. https://bugs.llvm.org/show_bug.cgi?id=24986 may be related to this issue. On the example file below, $ clang-cl /c /std:c++14 foo.cc works well, but $ clang-cl /c /std:c++17 foo.cc fails to compile. The error message was: ---- foo.cc(8,3): error: no matching function for call to 'f' f<p>(); ^~~~ foo.cc(12,3): note: in instantiation of function template specialization 'g<__uuidof(0)>' requested here g<&__uuidof(0)>(); ^ foo.cc(4,6): note: candidate template ignored: invalid explicitly-specified argument for 1st template parameter void f() {} ^ 1 error generated. ---- ---- foo.cc typedef struct _GUID {} GUID; template <const GUID*> void f() {} template <const GUID* p> void g() { f<p>(); } void h() { g<&__uuidof(0)>(); } ----
,
May 11 2018
Reduced it slightly. clang seems to confused on its type, or just miss `&` here.
---- foo.cc
typedef struct _GUID {} GUID;
template <const GUID* p>
void f() {
const GUID* q = p;
}
void g() {
f<&__uuidof(0)>();
}
----
$ clang-cl /c /std:c++17 foo.cc
foo.cc(5,15): error: no viable conversion from 'const _GUID' to 'const GUID *' (aka 'const _GUID *')
const GUID* q = p;
^ ~
foo.cc(9,3): note: in instantiation of function template specialization 'f<__uuidof(0)>' requested here
f<&__uuidof(0)>();
^
1 error generated.
,
May 11 2018
That sounds a lot like the issue above (which might be the same thing). Maybe https://reviews.llvm.org/D43576 helps with this too.
,
May 15 2018
#c3: That looks like a separate issue, and I hit it too. Let me file it separately.
,
May 16 2018
tzik filed issue 842996 for the other thing mentioned in comment 4, and sent https://reviews.llvm.org/D46820 as a fix for this bug here.
,
May 18 2018
,
May 25 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by thakis@chromium.org
, May 11 2018