Index: clang/lib/AST/ExprConstant.cpp =================================================================== --- clang/lib/AST/ExprConstant.cpp +++ clang/lib/AST/ExprConstant.cpp @@ -3095,7 +3095,7 @@ // constant-folding cases, where the variable is not actually of a suitable // type for use in a constant expression (otherwise the DeclRefExpr would // have been value-dependent too), so diagnose that. - assert(!VD->mightBeUsableInConstantExpressions(Info.Ctx)); + assert(!VD->isUsableInConstantExpressions(Info.Ctx)); if (!Info.checkingPotentialConstantExpression()) { Info.FFDiag(E, Info.getLangOpts().CPlusPlus11 ? diag::note_constexpr_ltor_non_constexpr Index: clang/test/AST/pr46865.cpp =================================================================== --- /dev/null +++ clang/test/AST/pr46865.cpp @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -fsyntax-only %s +typedef unsigned long size_t; + +namespace std { +template struct add_const { typedef const _Ty type; }; + +template class tuple {A a; B b; }; +template struct tuple_size; +template struct tuple_size {static constexpr size_t value = 2;}; // hardcoded 2 + +template struct tuple_element; +template struct tuple_element<0, tuple<_This, _that> > { typedef _This type; }; +template struct tuple_element<1, tuple<_This, _that> > { typedef _that type; }; + +template struct tuple_element<_Index, const _Tuple> { + typedef tuple_element<_Index, _Tuple> _Mybase; + typedef typename add_const::type type; +}; + +template inline constexpr const typename tuple_element<_Index, tuple >::type& + get(const tuple& _Tuple) noexcept {} + +template inline constexpr const typename tuple_element<0, tuple >::type& + get(const tuple& _Tuple) noexcept { return _Tuple.a; } +template inline constexpr const typename tuple_element<1, tuple >::type& + get(const tuple& _Tuple) noexcept { return _Tuple.b; } +} +std::tuple inline __attribute__((always_inline)) get_sc(unsigned v) {} + +template class bbb { + unsigned u; + inline __attribute__((always_inline)) void cebb(); +}; + +template void bbb::cebb() +{ + unsigned p; + auto const t = u; + auto const [s, c] = get_sc(t); + p = s; +} +