diff options
author | Vassil Vassilev <v.g.vassilev@gmail.com> | 2016-04-28 14:13:28 +0000 |
---|---|---|
committer | Vassil Vassilev <v.g.vassilev@gmail.com> | 2016-04-28 14:13:28 +0000 |
commit | 928c8254a9cfee98bd13c754723963bd8865c1b5 (patch) | |
tree | 4a7e73a1d0a68ea26ad3baeef70b02ea1adfc686 /clang/test/Modules | |
parent | 32617995732d88d245d98bdc0a6a02331f68b321 (diff) | |
download | bcm5719-llvm-928c8254a9cfee98bd13c754723963bd8865c1b5.tar.gz bcm5719-llvm-928c8254a9cfee98bd13c754723963bd8865c1b5.zip |
Reland r267691 fixing PR27535.
llvm-svn: 267882
Diffstat (limited to 'clang/test/Modules')
-rw-r--r-- | clang/test/Modules/Inputs/PR27401/a.h | 17 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/PR27401/b.h | 21 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/PR27401/module.modulemap | 1 | ||||
-rw-r--r-- | clang/test/Modules/pr27401.cpp | 38 |
4 files changed, 77 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/PR27401/a.h b/clang/test/Modules/Inputs/PR27401/a.h new file mode 100644 index 00000000000..63d6b707f46 --- /dev/null +++ b/clang/test/Modules/Inputs/PR27401/a.h @@ -0,0 +1,17 @@ +#ifndef _LIBCPP_ALGORITHM +#define _LIBCPP_ALGORITHM +template <class _Tp, _Tp> +struct integral_constant { + static const _Tp value = _Tp(); +}; + +template <class _Tp> +struct is_nothrow_default_constructible + : integral_constant<bool, __is_constructible(_Tp)> {}; + +template <class _Tp> +struct is_nothrow_move_constructible + : integral_constant<bool, __is_constructible(_Tp, _Tp)> {}; + +class allocator {}; +#endif diff --git a/clang/test/Modules/Inputs/PR27401/b.h b/clang/test/Modules/Inputs/PR27401/b.h new file mode 100644 index 00000000000..2b4e7f14fbb --- /dev/null +++ b/clang/test/Modules/Inputs/PR27401/b.h @@ -0,0 +1,21 @@ +#include "a.h" +#ifndef _LIBCPP_VECTOR +template <class, class _Allocator> +class __vector_base { +protected: + _Allocator __alloc() const; + __vector_base(_Allocator); +}; + +template <class _Tp, class _Allocator = allocator> +class vector : __vector_base<_Tp, _Allocator> { +public: + vector() noexcept(is_nothrow_default_constructible<_Allocator>::value); + vector(const vector &); + vector(vector &&) + noexcept(is_nothrow_move_constructible<_Allocator>::value); +}; + +#endif +void GetUniquePtrType() { vector<char> v; } + diff --git a/clang/test/Modules/Inputs/PR27401/module.modulemap b/clang/test/Modules/Inputs/PR27401/module.modulemap new file mode 100644 index 00000000000..a0efadaa0ea --- /dev/null +++ b/clang/test/Modules/Inputs/PR27401/module.modulemap @@ -0,0 +1 @@ +module "b" { header "b.h" export * } diff --git a/clang/test/Modules/pr27401.cpp b/clang/test/Modules/pr27401.cpp new file mode 100644 index 00000000000..7d5479cb924 --- /dev/null +++ b/clang/test/Modules/pr27401.cpp @@ -0,0 +1,38 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR27401 -verify %s +// RUN: %clang_cc1 -std=c++11 -fmodules -fmodule-map-file=%S/Inputs/PR27401/module.modulemap -fmodules-cache-path=%t -I%S/Inputs/PR27401 -verify %s + +#include "a.h" +#define _LIBCPP_VECTOR +template <class, class _Allocator> +class __vector_base { +protected: + _Allocator __alloc() const; + __vector_base(_Allocator); +}; + +template <class _Tp, class _Allocator = allocator> +class vector : __vector_base<_Tp, _Allocator> { +public: + vector() noexcept(is_nothrow_default_constructible<_Allocator>::value); + vector(const vector &); + vector(vector &&) + noexcept(is_nothrow_move_constructible<_Allocator>::value); +}; + +template <class _Tp, class _Allocator> +vector<_Tp, _Allocator>::vector(const vector &__x) : __vector_base<_Tp, _Allocator>(__x.__alloc()) {} + + struct CommentOptions { + vector<char> ParseAllComments; + CommentOptions() {} + }; + struct PrintingPolicy { + PrintingPolicy(CommentOptions LO) : LangOpts(LO) {} + CommentOptions LangOpts; + }; + +#include "b.h" +CommentOptions fn1() { return fn1(); } + +// expected-no-diagnostics |