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

            Bug ID: 41868
           Summary: Rejects valid on deprecated attributes with a
                    non-narrow string literal
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
          Assignee: unassignedclangb...@nondot.org
          Reporter: aa...@aaronballman.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

The following code is valid in C2x and C++11, but is currently rejected by
Clang:

[[deprecated(L"We can't have nice things")]] int a;

The problem is that Sema::checkStringLiteralArgumentAttr() requires the string
to be ASCII so that it can call StringLiteral::getString() to get a StringRef
to the contents. We could use StringLiteral::outputString() to stream it to a
string buffer, but there are other parts of the APIs that expect a StringRef
and not a std::string, so ClangAttrEmitter would need to be taught about this
for VariadicStringArgument arguments.

I think we might want to encode this as part of the attribute argument
declaration itself. Some attributes may require any form of string literal
(like deprecated does), while others may require ASCII (like section
attributes).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to