[llvm-bugs] [Bug 27113] New: MSVC-compat __identifier implementation incomplete

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 29 03:12:33 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27113

            Bug ID: 27113
           Summary: MSVC-compat __identifier implementation incomplete
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: turkeyman at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

MSVC has a feature __identifier("symbolname") which doesn't seem to work in
Clang.

One common use of __identifier is for keywords; ie, __identifier(class), which
works, but it also supports string identifiers which I make fairly extensive
use of in large multi-language projects.
MSVC produces a warning with string identifiers, which you are instructed to
suppress.

This code should compile:
auto x = (__pragma(warning(suppress: 4483)) __identifier("??_7MyClass@@6B@"));

Since MSVC mangling uses characters that are invalid in C++ identifiers (ie,
'?' and '@'), this is a trick to refer to symbols that are un-name-able.

On a side note; in VS, the symbol resolution yields a typed symbol, and type
deduction is correctly performed for 'x' in this case.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160329/7e9f1b9e/attachment.html>


More information about the llvm-bugs mailing list