[PATCH] D85084: [modules] Repro for pure virtual base class method crash

Andrew Gallagher via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 1 16:31:23 PDT 2020


andrewjcg created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
andrewjcg requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85084

Files:
  clang/test/Modules/Inputs/set-pure-crash/a.h
  clang/test/Modules/Inputs/set-pure-crash/b.h
  clang/test/Modules/Inputs/set-pure-crash/c.h
  clang/test/Modules/Inputs/set-pure-crash/module.modulemap
  clang/test/Modules/set-pure-crash.cpp


Index: clang/test/Modules/set-pure-crash.cpp
===================================================================
--- /dev/null
+++ clang/test/Modules/set-pure-crash.cpp
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -O0 -emit-llvm -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I %S/Inputs/set-pure-crash -verify %s -o %t
+
+// expected-no-diagnostics
+
+#include "b.h"
+#include "c.h"
+
+auto t = func<const char *>();
Index: clang/test/Modules/Inputs/set-pure-crash/module.modulemap
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/module.modulemap
@@ -0,0 +1,11 @@
+module a {
+  header "a.h"
+}
+
+module b {
+  header "b.h"
+}
+
+module c {
+  header "c.h"
+}
Index: clang/test/Modules/Inputs/set-pure-crash/c.h
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/c.h
@@ -0,0 +1,5 @@
+#pragma once
+
+template <typename>
+struct func {
+};
Index: clang/test/Modules/Inputs/set-pure-crash/b.h
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/b.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "a.h"
+#include "c.h"
+
+template <typename Fun, typename = func<Fun>>
+void foo(Fun) {}
+
+class Child : public Base<Tag> {
+public:
+  void func() {
+    foo([]() {});
+  }
+};
Index: clang/test/Modules/Inputs/set-pure-crash/a.h
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/a.h
@@ -0,0 +1,11 @@
+#pragma once
+
+struct Tag {};
+
+template <typename T>
+class Base {
+public:
+  virtual void func() = 0;
+};
+
+Base<Tag> bar();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85084.282422.patch
Type: text/x-patch
Size: 1761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200801/10de441b/attachment.bin>


More information about the cfe-commits mailing list