Skip to content

An explicit specialization declaration shall not be a friend declaration #54352

Closed
@namniav

Description

@namniav

n4861-temp.expl.spec

An explicit specialization declaration shall not be a friend declaration.

Clang compiles this code:
https://godbolt.org/z/eeah47bvb

template<int N>
consteval int foo();

template<int N>
struct Foo {
  friend consteval
  int foo<N>() {
      return 1;
  }
};

struct Bar {
    friend consteval
    int foo<1>() {
        return 2;
    }
};

int main() {
  Foo<0> f;
  return foo<0>() + foo<1>();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions