Open Quuxplusone opened 8 years ago
if you actually expand the macro by hand, you get a more sensible error message.
I'm still seeing this on trunk. May have something to do with errors
immediately after a '::'. Here's another test case exhibiting this behavior:
--
class Foo {};
#define WHOOPS void Foo::&bar() {}
WHOOPS
--
https://godbolt.org/z/Oisd-x
Also confirming on godbolt that I see this behavior for clang 7.0.0, 6.0.0,
5.0.0, 4.0.1, 4.0.0, 3.9.1, 3.9.0, 3.8.1, and 3.8.
3.7.1 indeed gives the proper error:
<source>:5:1: error: expected unqualified-id
WHOOPS
^
<source>:3:26: note: expanded from macro 'WHOOPS'
#define WHOOPS void Foo::&bar() {}
^
1 error generated.
--
Clang trunk error:
error: expected unqualified-id
1 error generated.
--
GCC 8.2 error:
<source>:3:26: error: expected unqualified-id before '&' token
#define WHOOPS void Foo::&bar() {}
^
<source>:5:1: note: in expansion of macro 'WHOOPS'
WHOOPS
^~~~~~
Attached file_28680.txt
(61 bytes, text/plain): new_test_case.cpp
Attached file_28680.txt
(159 bytes, text/plain): original_test_case.cpp
file_28680.txt
(61 bytes, text/plain)file_28680.txt
(159 bytes, text/plain)