New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in __uuidof support: &__uuidof(X) template parameter turns into __uuidof(X) #25360
Comments
This only reproduces in a non-MSVC environment. It works with clang-cl and does the same thing as MSVC. |
Ignore that, it's not the issue. I wasn't using c++1z, which appears to matter. |
Richard added some uuid handling code for C++1z in r222807. I guess it's not quite right for pointers to uuids. |
David and Richard, I took a look at this, but the fix wasn't obvious. How are the C++1z rules implemented by r222807 supposed to interact with __uuidof? |
Thanks for looking into this so quickly. Apparently I was too adventurous by going C++1z :-) |
What is the status of this bug? C++1z isn't as experimal as it was when Sebastian first reported the regression. |
It looks like the problem is that we don't have a sensible canonical representation for __uuidof(X) / &__uuidof(X) as a TemplateArgument, and instead fake it up as an Expr* (violating the rule that the Expr* form is non-canonical in the process); the C++1z evaulation path evaluates the expression and represents the uuidof case as the base expression of the lvalue / pointer (losing the '&' in the process). The quick hack fix would be to change the CXXUuidofExpr case in the C++1z codepath to build a unary '&' expression wrapping the CXXUuidofExpr in the pointer case, but it would be better to fix this by extending TemplateArgument to have a dedicated kind for a canonical __uuidof(X) argument (representing either the lvalue or pointer case, just like the Declaration kind). |
This would naturally fall out if we treated __declspec(uuid) the same way MSVC does: by declaring a variable. __uuidof just creates a reference to that variable. |
Sounds good to me :-) Is there any chance this could be done in a reasonable timeframe? |
I am on trunk an I am hitting this issue. I don't have any "-std=c++??" explicitly set. Any updates on solving it? if I can help somehow let me know. |
*** Bug llvm/llvm-bugzilla-archive#33076 has been marked as a duplicate of this bug. *** |
I hit similar issue. http://crbug.com/842118 is a downstream issue. ---- foo.cc template <const GUID* p> void g() {
|
r332614, with what I think is the 'quick hack fix' mentioned in comment 7. |
*** Bug llvm/llvm-bugzilla-archive#37824 has been marked as a duplicate of this bug. *** |
mentioned in issue llvm/llvm-bugzilla-archive#33076 |
mentioned in issue llvm/llvm-bugzilla-archive#37824 |
Extended Description
The COM headers use pointers to the IID/GUID struct as template parameters, e.g. in the _com_IIID class. This was supported in clang 3.6 but stopped working again in clang 3.7 onwards. The bug is still present in the Trunk, as far as I can tell with http://melpon.org/wandbox
IID_Test is (silently) instantiated not with a IID const* but with the IID itself. The attached example prints the instantiated types and IID_Test is indeed a _com_IIID<Test, __uuidof(Test)> (note the missing & in front of __uuidof)
To reproduce, compile the attached (complete) example with
The text was updated successfully, but these errors were encountered: