Skip to content

[clang] Pointer to member function should reject explicit object parameter #85992

@Rajveer100

Description

@Rajveer100

Clang accepts the following invalid code:

struct S {
  int f(int);
};

using T = int (S::*)(this int);  // Invalid
T t = &S::f;

GCC corectly rejects it:

error: a pointer to member function type cannot have an explicit object parameter
    4 | using T = int (S::*)(this int);  // INVALID
      |                      ^~~~~~~~
note: the type of a pointer to explicit object member function is a regular pointer to function type

GodBolt

Metadata

Metadata

Assignees

Labels

accepts-invalidclang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions