Skip to content

Clang rejects valid program involving explict object member function #98641

Open
@ranaanoop

Description

@ranaanoop

The following valid program is rejected by clang and gcc but accepted by msvc. Demo

#include <iostream>

struct C{
   int f(this int);
};

decltype(C::f) func; //msvc accepts but clang and gcc rejects
  
int func(int j)
{
   std::cout << "called with: " << j << std::endl;
   return 5;
}

For future reference, the bug was discovered here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partydiverges-from:msvcDoes the clang frontend diverge from msvc on this issuerejects-valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions