Skip to content

STR2WSTR(__FUNCTION__) should work in microsoft mode #12161

Closed
@nico

Description

@nico
Bugzilla Link 11789
Resolution FIXED
Resolved on Sep 07, 2015 01:26
Version unspecified
OS Windows NT
Blocks llvm/llvm-bugzilla-archive#12477
CC @majnemer,@zmodem,@tritao

Extended Description

#include <stdio.h>

#define _FOO_STR2WSTR(s) L##s
#define FOO_STR2WSTR(s) _FOO_STR2WSTR(s)

int main() {
//const wchar_t* kFoo = L__FUNCTION__; // doesn't work in cl.exe
const wchar_t* kWFoo = FOO_STR2WSTR(FUNCTION); // works in cl
}

Both gcc and clang don't allow this, but cl.exe does. (gcc and clang support it for e.g. FILE.)

This is used in msvc's c++ standard headers.

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions