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

            Bug ID: 82380
           Summary: [concepts] Error when using requires constraint with
                    attributes
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

I believe the below code should work but it gives me the error:

main.cpp:6:1: error: two consecutive '[' shall only introduce an attribute
before '[' token
 [[nodiscard]] int f(T t) {
 ^

tested with gcc head 8.0.0 201709

///////////////////////////////////////////////////////////////////
template <class T>
concept bool C = true;

template <class T>
  requires C<T>
[[nodiscard]] int f(T t) {
  return 22;
}

int main() {
  return 0;
}
///////////////////////////////////////////////////////////////////

Reply via email to