summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-08-03 01:00:01 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-08-03 01:00:01 +0000
commita62d198ef5cef0500ea11b4c0c078c024e72f175 (patch)
tree38b5eca392dd57bdc7afdf6f3c4592385ba5ff39 /clang/test
parent7c84e3810429a04af77b6018d13310ad79346dff (diff)
downloadbcm5719-llvm-a62d198ef5cef0500ea11b4c0c078c024e72f175.tar.gz
bcm5719-llvm-a62d198ef5cef0500ea11b4c0c078c024e72f175.zip
[modules] Defer merging deduced return types.
We can't read a deduced return type until we are sure that the types referred to by it are not in the middle of being loaded. So defer all reading of such deduced return types until the end of the recursive deserialization step. Also, when we load a function type that has a deduced return type, update all other redeclarations of the function to have that deduced return type. llvm-svn: 338798
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Modules/merge-deduced-return.cpp6
-rw-r--r--clang/test/Modules/merge-lambdas.cpp3
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/Modules/merge-deduced-return.cpp b/clang/test/Modules/merge-deduced-return.cpp
index 0a4de7b9755..71dc29b633b 100644
--- a/clang/test/Modules/merge-deduced-return.cpp
+++ b/clang/test/Modules/merge-deduced-return.cpp
@@ -8,6 +8,8 @@ module A {}
#pragma clang module begin A
inline auto f() { struct X {}; return X(); }
inline auto a = f();
+auto g(int);
+template<typename T> auto h(T t) { return g(t); }
#pragma clang module end
#pragma clang module endbuild
@@ -17,12 +19,14 @@ module B {}
#pragma clang module begin B
inline auto f() { struct X {}; return X(); }
inline auto b = f();
+auto g(int) { return 0; }
#pragma clang module end
#pragma clang module endbuild
#ifdef LOCAL
inline auto f() { struct X {}; return X(); }
inline auto b = f();
+auto g(int) { return 0; }
#else
#pragma clang module import B
#endif
@@ -31,3 +35,5 @@ inline auto b = f();
using T = decltype(a);
using T = decltype(b);
+
+int test_g = h(0);
diff --git a/clang/test/Modules/merge-lambdas.cpp b/clang/test/Modules/merge-lambdas.cpp
index 8b3b5013284..463a4c9b2fc 100644
--- a/clang/test/Modules/merge-lambdas.cpp
+++ b/clang/test/Modules/merge-lambdas.cpp
@@ -46,3 +46,6 @@ using U = decltype(y2);
using V = decltype(x3);
using V = decltype(y3);
+
+#pragma clang module import A
+void (*p)() = f<int>();
OpenPOWER on IntegriCloud