https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97600

            Bug ID: 97600
           Summary: [ranges] result of static assertion depends on
                    unrelated statement
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

$ cat testcase.C
$#include <sstream>
#include <ranges>

int main() {
  using namespace std::ranges;
  basic_istream_view<int, char, std::char_traits<char>> v;
  v.begin();
  static_assert(range<decltype(v)>);
}

$ g++ -std=c++20 testcase.C
testcase.C:8:17: error: static assertion failed
    8 |   static_assert(range<decltype(v)>);
      |                 ^~~~~~~~~~~~~~~~~~


Unexpectedly, this static assert fails.  Even more unexpectedly, if we remove
the 'v.begin()' line before it, then the static assert succeeds.

Reply via email to