Skip to content

instantiating a friend member specialization declaration does not look up member specialization properly #38231

@zygoloid

Description

@zygoloid
mannequin
Bugzilla Link 38883
Resolution FIXED
Resolved on May 10, 2019 10:44
Version 8.0
OS All
CC @DougGregor

Extended Description

Clang rejects this valid code with an access violation error:

struct A { template static int g0(T x) { return x.n; } };
template class B { friend int A::g0<>(B); int n; };
int k = A().g0(B());

The problem is that in the instantiation B, the friend declaration points nowhere (and does not identify the A::g0<B> specialization that it should). Despite the friend declaration not being matched to any function, no diagnostic is issued, and the result is the friend declaration is silently ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions