Am 30.10.2011 19:09, schrieb
cryptoo...@gmail.com:
> Consider:
> % cat liter.cpp
> #define BAR "foo"
> int main()
> {
> char *foobar("foo/"BAR);
> }
>
> % g++ liter.cpp -std=gnu++0x
> liter.cpp: In function ‘int main()’:
> liter.cpp:4:16: error: unable to find user-defined string literal operator ‘operator"" BAR’
>
> Is this the expected behavior?
Yes, this is a known backward-compatibility break of C++11, it is listed
in annex C.2.1, 2.5:
<quote>
Change: User-defined literal string support
Rationale: Required for new features.
Effect on original feature: Valid C++ 2003 code may fail to compile or
produce different results in this International Standard, as the
following example illustrates.
#define _x "there"
"hello"_x // #1
Previously, #1 would have consisted of two separate preprocessing tokens
and the macro _x would have been expanded. In this International
Standard, #1 consists of a single preprocessing tokens, so the macro
is not expanded.
</quote>
HTH & Greetings from Bremen,
Daniel Krügler