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

            Bug ID: 106758
           Summary: [concepts] Narrowing conversion inside brace-enclosed
                    initializer list reported as invalid expression
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: brock at cs dot berkeley.edu
  Target Milestone: ---

The following concept is failing, saying that `bar({{12, 12}, 12})` is an
invalid expression. I believe it is a valid expression, just with a narrowing
conversion inside it.

I've observed this behavior with Homebrew's M1 Mac distribution of GCC 12.2.0,
as well as Ubuntu 22.04 x86-64's distribution of GCC 11.2.0.  The concept works
as expected with Apple's distribution of Clang 13.1.6 and Ubuntu's distribution
of Clang 14.0.0.

----

#include <tuple>

void bar(std::tuple<std::tuple<int, int>, float> tuple) {}

template <typename T>
concept test_expression = requires(T value) {
                            bar({{12, 12}, value});
                          };

template <test_expression T>
void foo(T&&) {}

int main(int argc, char** argv) {
  // The following is a valid expression that compiles in GCC and Clang.
  // bar({{12, 12}, 12});

  // This concept fails in GCC (but not Clang).
  foo(12);

  return 0;
}

Reply via email to