File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -4984,6 +4984,15 @@ bool Compiler<Emitter>::visitDeclStmt(const DeclStmt *DS) {
49844984 return false ;
49854985 if (!this ->visitVarDecl (VD))
49864986 return false ;
4987+
4988+ // Register decomposition decl holding vars.
4989+ if (const auto *DD = dyn_cast<DecompositionDecl>(VD)) {
4990+ for (auto *BD : DD->bindings ())
4991+ if (auto *KD = BD->getHoldingVar ()) {
4992+ if (!this ->visitVarDecl (KD))
4993+ return false ;
4994+ }
4995+ }
49874996 }
49884997
49894998 return true ;
Original file line number Diff line number Diff line change @@ -105,3 +105,23 @@ constexpr S s = getS(); // both-error {{must be initialized by a constant expres
105105 // both-note {{declared here}}
106106static_assert (s.a == 12 , " " ); // both-error {{not an integral constant expression}} \
107107 // both-note {{initializer of 's' is not a constant expression}}
108+
109+ using size_t = decltype (sizeof (0 ));
110+ namespace std { template <typename T> struct tuple_size ; }
111+ namespace std { template <size_t , typename > struct tuple_element ; }
112+
113+ namespace constant {
114+ struct Q {};
115+ template <int N> constexpr int get (Q &&) { return N * N; }
116+ }
117+ template <> struct std ::tuple_size<constant::Q> { static const int value = 3 ; };
118+ template <int N> struct std ::tuple_element<N, constant::Q> { typedef int type; };
119+
120+ namespace constant {
121+ Q q;
122+ constexpr bool f () {
123+ auto [a, b, c] = q;
124+ return a == 0 && b == 1 && c == 4 ;
125+ }
126+ static_assert (f());
127+ }
You can’t perform that action at this time.
0 commit comments