[clang] Revert "[DebugInfo] Ignore undefined constexpr constructors in constructor homing." (PR #221566)
Avi Kivity via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 6 10:45:54 PDT 2026
avikivity wrote:
> > The original case where I got hit with this was some abseil map, the type without debugging information was std::pair.
> > libstdc++ has these constructors for pair:
> > ```c++
> > constexpr pair(const pair&) = default; ///< Copy constructor
> >
> > constexpr pair(pair&&) = default; ///< Move constructor
> >
> >
> >
> > template<typename... _Args1, typename... _Args2>
> >
> > _GLIBCXX20_CONSTEXPR
> >
> > pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>);
> >
> >
> >
> > template<typename... _Args1, size_t... _Indexes1,
> >
> > typename... _Args2, size_t... _Indexes2>
> >
> > _GLIBCXX20_CONSTEXPR
> >
> > pair(tuple<_Args1...>&, tuple<_Args2...>&,
> >
> > _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
> >
> >
> >
> > constexpr
> >
> > explicit(__not_<__and_<__is_implicitly_default_constructible<_T1>,
> >
> > __is_implicitly_default_constructible<_T2>>>())
> >
> > pair()
> >
> > noexcept(is_nothrow_default_constructible_v<_T1>
> >
> > && is_nothrow_default_constructible_v<_T2>)
> >
> > requires is_default_constructible_v<_T1>
> >
> > && is_default_constructible_v<_T2>
> >
> > : first(), second()
> >
> > { }
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > I see that abseil uses the piecewise_construct constructor, which at the point of the template definition, is declared but not defined. It is defined later.
> > Could it be that at the point the code checks whether the constexpr constructor is defined or not, the compiler hasn't instantiated the constructor definition?
>
> Could you write a minimal repro that compiles but lacks debug info? I'm happy to try to fix-forward, and if we can't we can roll back the original change.
See https://github.com/llvm/llvm-project/pull/221566#discussion_r3944740708. Apparently there's a loophole that allows using a struct that was never constructed.
https://github.com/llvm/llvm-project/pull/221566
More information about the cfe-commits
mailing list