diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2015-04-28 17:58:47 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2015-04-28 17:58:47 +0000 |
commit | 907233fd99182cf9ca794bec7bc974939dd1c4ed (patch) | |
tree | 55f2a328788fa2d08c17db9f7b5a32dc0099fa0f /clang/test/SemaTemplate/instantiate-local-class.cpp | |
parent | 96301d2455e658aae00d99e3ad8ca65abc92a04c (diff) | |
download | bcm5719-llvm-907233fd99182cf9ca794bec7bc974939dd1c4ed.tar.gz bcm5719-llvm-907233fd99182cf9ca794bec7bc974939dd1c4ed.zip |
Combine instantiation context of field initializer with context of class.
Inclass initializer is instantiated in its own LocalInstantiationScope. It
causes problems when instantiating local classes - when instantiation scope
is searched for DeclContext of the field, the search fails. As a solution,
the instantiation scope of field initializer is combined with its outer
scope.
This patch fixes PR23194.
Differential Revision: http://reviews.llvm.org/D9258
llvm-svn: 236005
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-local-class.cpp')
-rw-r--r-- | clang/test/SemaTemplate/instantiate-local-class.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-local-class.cpp b/clang/test/SemaTemplate/instantiate-local-class.cpp index c9897b9c614..367134a2a53 100644 --- a/clang/test/SemaTemplate/instantiate-local-class.cpp +++ b/clang/test/SemaTemplate/instantiate-local-class.cpp @@ -194,3 +194,22 @@ struct B { void f() { F<int>(); } }; } + +namespace PR23194 { + struct X { + int operator()() const { return 0; } + }; + struct Y { + Y(int) {} + }; + template <bool = true> int make_seed_pair() noexcept { + struct state_t { + X x; + Y y{x()}; + }; + return 0; + } + int func() { + return make_seed_pair(); + } +} |