Bug 54968 - spurious constexpr error, 20_util/tuple/comparison_operators/35480_neg.cc
Summary: spurious constexpr error, 20_util/tuple/comparison_operators/35480_neg.cc
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: constexpr
  Show dependency treegraph
 
Reported: 2012-10-18 08:15 UTC by Benjamin Kosnik
Modified: 2014-11-17 20:44 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
pre-processed test (10.69 KB, application/x-bzip)
2012-10-18 08:15 UTC, Benjamin Kosnik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Kosnik 2012-10-18 08:15:37 UTC
Created attachment 28477 [details]
pre-processed test

While finishing up the latest constexpr hacking, I noticed that tuple's relational operators now give a bogus excess error:

FAIL: 20_util/tuple/comparison_operators/35480_neg.cc (test for excess errors)
Excess errors:
/mnt/share/bld/gcc.git-trunk/x86_64-unknown-linux-gnu/libstdc++-v3/include/tuple:824:5: error: body of constexpr function 'constexpr bool std::operator<(const std::tuple<_Elements ...>&, const std::tuple<_Elements ...>&) [with _TElements = {int}; _UElements = {int, int}]' not a return-statement
/mnt/share/bld/gcc.git-trunk/x86_64-unknown-linux-gnu/libstdc++-v3/include/tuple:813:5: error: body of constexpr function 'constexpr bool std::operator==(const std::tuple<_Elements ...>&, const std::tuple<_Elements ...>&) [with _TElements = {int}; _UElements = {int, int}]' not a return-statement


but this seems unlikely, given:

  template<typename... _TElements, typename... _UElements>
    constexpr bool
    operator==(const tuple<_TElements...>& __t,
	       const tuple<_UElements...>& __u)
    {
      typedef tuple<_TElements...> _Tp;
      typedef tuple<_UElements...> _Up;
      return (__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value,
	      0, tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u));
    }

and more importantly, the passing of the positive test here:
libstdc++-v3/testsuite/20_util/tuple/comparison_operators/constexpr.cc

Reasonable people may disagree, and hey, it's late.
Comment 1 Jason Merrill 2014-11-17 20:44:17 UTC
When compiling with trunk this error follows another error:

/mnt/share/bld/gcc.git-trunk/x86_64-unknown-linux-gnu/libstdc++-v3/include/tuple:823:52: error: incomplete type ‘std::__tuple_compare<18446744073709551615ul, 0ul, 1ul, std::tuple<int>, std::tuple<int, int> >’ used in nested name specifier

and that test now passes, so I'm just going to close this BZ.

(hi, bkoz!)