QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#597544#9347. Competition in Swiss-systemMaMengQiCompile Error//C++203.2kb2024-09-28 17:59:412024-09-28 17:59:45

詳細信息

answer.code: In member function ‘constexpr fact fact::operator+(const fact&) const’:
answer.code:35:20: warning: invalid return type ‘fact’ of ‘constexpr’ function ‘constexpr fact fact::operator+(const fact&) const’ [-Winvalid-constexpr]
   35 |     constexpr fact operator+(const fact &o) const { return fact(p * o.q + q * o.p, q * o.q); }
      |                    ^~~~~~~~
answer.code:26:8: note: ‘fact’ is not literal because:
   26 | struct fact
      |        ^~~~
answer.code:26:8: note:   ‘fact’ is not an aggregate, does not have a trivial default constructor, and has no ‘constexpr’ constructor that is not a copy or move constructor
answer.code: In member function ‘constexpr fact fact::operator-(const fact&) const’:
answer.code:36:20: warning: invalid return type ‘fact’ of ‘constexpr’ function ‘constexpr fact fact::operator-(const fact&) const’ [-Winvalid-constexpr]
   36 |     constexpr fact operator-(const fact &o) const { return fact(p * o.q - q * o.p, q * o.q); }
      |                    ^~~~~~~~
answer.code: In member function ‘constexpr fact fact::operator*(const fact&) const’:
answer.code:37:20: warning: invalid return type ‘fact’ of ‘constexpr’ function ‘constexpr fact fact::operator*(const fact&) const’ [-Winvalid-constexpr]
   37 |     constexpr fact operator*(const fact &o) const { return fact(p * o.p, q * o.q); }
      |                    ^~~~~~~~
answer.code: In member function ‘constexpr fact fact::operator/(const fact&) const’:
answer.code:38:20: warning: invalid return type ‘fact’ of ‘constexpr’ function ‘constexpr fact fact::operator/(const fact&) const’ [-Winvalid-constexpr]
   38 |     constexpr fact operator/(const fact &o) const { return fact(p * o.q, q * o.p); }
      |                    ^~~~~~~~
answer.code: In member function ‘constexpr fact& fact::operator+=(const fact&)’:
answer.code:39:70: warning: temporary of non-literal type ‘fact’ in a constant expression [-Winvalid-constexpr]
   39 |     constexpr fact& operator+=(const fact &o) { return *this = *this + o; }
      |                                                                ~~~~~~^~~
answer.code: In member function ‘constexpr fact& fact::operator-=(const fact&)’:
answer.code:40:70: warning: temporary of non-literal type ‘fact’ in a constant expression [-Winvalid-constexpr]
   40 |     constexpr fact& operator-=(const fact &o) { return *this = *this - o; }
      |                                                                ~~~~~~^~~
answer.code: In member function ‘constexpr fact& fact::operator*=(const fact&)’:
answer.code:41:70: warning: temporary of non-literal type ‘fact’ in a constant expression [-Winvalid-constexpr]
   41 |     constexpr fact& operator*=(const fact &o) { return *this = *this * o; }
      |                                                                ~~~~~~^~~
answer.code: In member function ‘constexpr fact& fact::operator/=(const fact&)’:
answer.code:42:70: warning: temporary of non-literal type ‘fact’ in a constant expression [-Winvalid-constexpr]
   42 |     constexpr fact& operator/=(const fact &o) { return *this = *this / o; }
      |                                                                ~~~~~~^~~
In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:1:
/usr/include/c++/13/bits/stl_algobase.h: In instantiation of ‘constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = fact]’:
answer.code:100:69:   required from here
/usr/include/c++/13/bits/stl_algobase.h:262:15: error: no match for ‘operator<’ (operand types are ‘const fact’ and ‘const fact’)
  262 |       if (__a < __b)
      |           ~~~~^~~~~
answer.code:43:20: note: candidate: ‘constexpr auto fact::operator<=>(const fact&)’ (near match)
   43 |     constexpr auto operator<=>(const fact &o) { return p * o.q <=> q * o.p; }
      |                    ^~~~~~~~
answer.code:43:20: note:   passing ‘const fact*’ as ‘this’ argument discards qualifiers
In file included from /usr/include/c++/13/bits/stl_algobase.h:67:
/usr/include/c++/13/bits/stl_iterator.h:583:5: note: candidate: ‘template<class _IteratorL, class _IteratorR>  requires  three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorR>&)’ (reversed)
  583 |     operator<=>(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:583:5: note:   template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_algobase.h:262:15: note:   ‘const fact’ is not derived from ‘const std::reverse_iterator<_IteratorL>’
  262 |       if (__a < __b)
      |           ~~~~^~~~~
/usr/include/c++/13/bits/stl_iterator.h:1690:5: note: candidate: ‘template<class _IteratorL, class _IteratorR>  requires  three_way_comparable_with<_IteratorR, _Ite...