[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 14:33:36 PST 2019


void updated this revision to Diff 183180.
void added a comment.

Move test to proper place and add "-verify" flag.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57114/new/

https://reviews.llvm.org/D57114

Files:
  lib/Sema/SemaTemplate.cpp
  test/SemaCXX/PR40395.cpp


Index: test/SemaCXX/PR40395.cpp
===================================================================
--- /dev/null
+++ test/SemaCXX/PR40395.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -std=c++17 -fms-extensions -triple=x86_64-pc-win32 -verify %s
+// expected-no-diagnostics
+
+// PR40395 - ConstantExpr shouldn't cause the template object to infinitely
+// expand.
+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.183180.patch
Type: text/x-patch
Size: 1145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190123/c8e12d57/attachment.bin>


More information about the cfe-commits mailing list