https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86494
Bug ID: 86494 Summary: Usage in unevaluated context causes compile time errors because of implicit deletion Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Following code: template<typename T1> struct pair { T1 first; pair() = default; pair(const pair&) = default; pair(pair&&) = default; pair& operator=(pair&& __p); pair& operator=(const pair& __p); }; struct Idx : public pair<int> { using pair::pair; using pair::operator=; }; template<typename _Tp> _Tp&& declval() noexcept; int main() { // Comment out the next line and everything will compile using t = decltype(declval<Idx>() = declval<Idx>()); Idx p{}; Idx p2(p); } Fails to compile on GCC with the following error: <source>: In function 'int main()': <source>:25:13: error: use of deleted function 'constexpr Idx::Idx(const Idx&)' Idx p2(p); ^ <source>:13:8: note: 'constexpr Idx::Idx(const Idx&)' is implicitly declared as deleted because 'Idx' declares a move constructor or move assignment operator struct Idx : public pair<int> { ^~~ However clang compiles that code well. With line 'using t =...' commented out everything compiles well on GCC.