Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

"error: expected unqualified-id" -- that's the entirety of the error message #28679

Open Quuxplusone opened 8 years ago

Quuxplusone commented 8 years ago
Bugzilla Link PR28680
Status CONFIRMED
Importance P normal
Reported by Zac Hansen (xaxxon@gmail.com)
Reported on 2016-07-23 19:07:59 -0700
Last modified on 2018-12-12 12:32:37 -0800
Version trunk
Hardware All All
CC b@ileyparker.com, dgregor@apple.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments file_28680.txt (61 bytes, text/plain)
file_28680.txt (159 bytes, text/plain)
Blocks
Blocked by
See also
no filename, no line number, no nothing, except:

error: expected unqualified-id

Checking on godbolt, it seems to be a regression between 3.7.1 and 3.8.

https://godbolt.org/g/7Duczj

class Foo {
 static const char * string;
};

#define MESSAGE_STUFF(type, string) \
    const char * type::string = string;

  MESSAGE_STUFF(Foo, "hello");
Quuxplusone commented 8 years ago

if you actually expand the macro by hand, you get a more sensible error message.

Quuxplusone commented 5 years ago
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

 ^~~~~~
Quuxplusone commented 5 years ago

Attached file_28680.txt (61 bytes, text/plain): new_test_case.cpp

Quuxplusone commented 5 years ago

Attached file_28680.txt (159 bytes, text/plain): original_test_case.cpp