Bug 60680 - unqualified-id expected, gcc fails to diagnose and accepts invalid
Summary: unqualified-id expected, gcc fails to diagnose and accepts invalid
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2014-03-27 01:59 UTC by Filip Roséen
Modified: 2019-06-17 18:44 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-03-27 00:00:00


Attachments
testcase.cpp (45 bytes, text/x-c++src)
2014-03-27 01:59 UTC, Filip Roséen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Roséen 2014-03-27 01:59:36 UTC
Created attachment 32464 [details]
testcase.cpp

int main () {
  int(*) = 0;
}

----------------------------------------------------------------------------------

The above compiles but the above is not legal according to any section of the Standard. `clang` correctly throws out a diagnostic saying that the line in question is ill-formed.

There are many variations on the above that gcc happily accepts, such as:

`auto(*)(int) = 0`, `auto(*)() = 0`, etc, etc.
Comment 1 Marek Polacek 2019-06-17 18:44:48 UTC
This is now rejected:

60680.C: In function ‘int main()’:
60680.C:2:3: error: expected primary-expression before ‘int’
    2 |   int(*) = 0;
      |   ^~~