Skip to content

[clang-cl] __FUNCTION__ used in templated function is not returning the same string than MSVC. #66114

Open
@zahiraam

Description

@zahiraam

__FUNCTION__ in clang is not returning the same string than MS for templated functions.

See https://godbolt.org/z/88n1rGs3b

For this test case MSVC is returning:
function: TestClass<class UnitTestNative>::TestClass
func: TestClass

I have looked at it briefly. It looks like a fix can be implemented in PredefinedExpr::ComputeName by adding a case for IK==PredefinedExpr::Function? However, I couldn't find a way to stick the "class" keyword in front of the class name. May be some policy argument should be used to print the function?
Unless everything should be computed in PredefinedExpr::ComputeName using some string manipulation (meaning getting the string from printQualifiedName and manipulating it to get the "class" keyword?

@RIscRIpt I think you have been working on MS compatibility. I am wondering if you are currently working on this or if you might have some suggestion on the fix I am about to work on?
Thanks.

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