New issue
Advanced search Search tips

Issue 842118 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocked on:
issue 844392

Blocking:
issue 752720



Sign in to add a comment

__uuidof() in C++17 causes compile error on clang-cl

Project Member Reported by tzik@chromium.org, May 11 2018

Issue description

clang-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)>();
}
----
 

Comment 1 by thakis@chromium.org, May 11 2018

Upstream uuidof issues (which don't look like this one, but do look vaguely related):
https://reviews.llvm.org/D43576 / https://bugs.llvm.org/show_bug.cgi?id=27066
https://bugs.llvm.org/show_bug.cgi?id=24986

Comment 2 by tzik@chromium.org, 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.

Comment 3 by thakis@chromium.org, 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.

Comment 4 by tzik@chromium.org, May 15 2018

#c3: That looks like a separate issue, and I hit it too. Let me file it separately.

Comment 5 by thakis@chromium.org, 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.

Comment 6 by thakis@chromium.org, May 18 2018

Blockedon: 844392

Comment 7 by tzik@chromium.org, May 25 2018

Status: Fixed (was: ExternalDependency)

Sign in to add a comment