[PATCH] D57114: Remove Expr sugar decorating the CXXUuidofExpr node.

Bill Wendling via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 23 12:13:43 PST 2019


void created this revision.
void added a reviewer: rsmith.
Herald added a subscriber: cfe-commits.

Sugar, like ConstantExpr, causes an infinite expansion of the template object.


Repository:
  rC Clang

https://reviews.llvm.org/D57114

Files:
  lib/Sema/SemaTemplate.cpp
  test/CodeGenCXX/pr40395.cpp


Index: test/CodeGenCXX/pr40395.cpp
===================================================================
--- /dev/null
+++ test/CodeGenCXX/pr40395.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++17 -fms-extensions -emit-llvm %s -o - -triple=x86_64-pc-win32
+
+struct _GUID {};
+struct __declspec(uuid("{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}")) B {};
+
+template <const _GUID* piid>
+struct A {
+  virtual void baz() { A<piid>(); }
+};
+
+void f() {
+  A<&__uuidof(B)>();
+}
Index: lib/Sema/SemaTemplate.cpp
===================================================================
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -6308,7 +6308,7 @@
       // -- a predefined __func__ variable
       if (auto *E = Value.getLValueBase().dyn_cast<const Expr*>()) {
         if (isa<CXXUuidofExpr>(E)) {
-          Converted = TemplateArgument(ArgResult.get());
+          Converted = TemplateArgument(ArgResult.get()->IgnoreImpCasts());
           break;
         }
         Diag(Arg->getBeginLoc(), diag::err_template_arg_not_decl_ref)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57114.183149.patch
Type: text/x-patch
Size: 1042 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190123/d3586a61/attachment.bin>


More information about the cfe-commits mailing list