diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-02-07 22:25:16 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-02-07 22:25:16 +0000 |
commit | f3b4ca89e7ac55cfda8734630863e866a6da14cd (patch) | |
tree | 14d43e1456ec2bab2954c14c13d22eaf916ed38a /clang/test/SemaTemplate/instantiate-init.cpp | |
parent | 1db5ebc016c277ab55c25eec7e14dadb753eeb27 (diff) | |
download | bcm5719-llvm-f3b4ca89e7ac55cfda8734630863e866a6da14cd.tar.gz bcm5719-llvm-f3b4ca89e7ac55cfda8734630863e866a6da14cd.zip |
PR36055: fix computation of *-dependence in nested initializer lists.
When we synthesize an implicit inner initializer list when analyzing an outer
initializer list, we add it to the outer list immediately, and then fill in the
inner list. This gives the outer list no chance to update its *-dependence bits
with those of the completed inner list. To fix this, re-add the inner list to
the outer list once it's completed.
Note that we do not recompute the *-dependence bits from scratch when we
complete an outer list; this would give the wrong result for the case where a
designated initializer overwrites a dependent initializer with a non-dependent
one. The resulting list in that case should still be dependent, even though all
traces of the dependence were removed from the semantic form.
llvm-svn: 324537
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-init.cpp')
-rw-r--r-- | clang/test/SemaTemplate/instantiate-init.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-init.cpp b/clang/test/SemaTemplate/instantiate-init.cpp index 244e94f6d60..51fa6955d0c 100644 --- a/clang/test/SemaTemplate/instantiate-init.cpp +++ b/clang/test/SemaTemplate/instantiate-init.cpp @@ -142,3 +142,17 @@ namespace ReturnStmtIsInitialization { template<typename T> X f() { return {}; } auto &&x = f<void>(); } + +namespace InitListUpdate { + struct A { int n; }; + using AA = A[1]; + + // Check that an init list update doesn't "lose" the pack-ness of an expression. + template <int... N> void f() { + g(AA{0, [0].n = N} ...); // expected-warning 3{{overrides prior init}} expected-note 3{{previous init}} + g(AA{N, [0].n = 0} ...); // expected-warning 3{{overrides prior init}} expected-note 3{{previous init}} + }; + + void g(AA, AA); + void h() { f<1, 2>(); } // expected-note {{instantiation of}} +} |