This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/86601] New: g++ accepts 'friend' at ill-formed positions in the decl-specifier-seq
- From: "zhonghao at pku dot org.cn" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 20 Jul 2018 06:18:28 +0000
- Subject: [Bug c++/86601] New: g++ accepts 'friend' at ill-formed positions in the decl-specifier-seq
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86601
Bug ID: 86601
Summary: g++ accepts 'friend' at ill-formed positions in the
decl-specifier-seq
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: zhonghao at pku dot org.cn
Target Milestone: ---
g++ accepts this:
struct S {
class T friend;
unsigned friend char;
};
Both of these are illegal by [class.friend]p3, which requires the 'friend'
decl-specifier to be the first in the decl-specifier-seq for non-function
declarations.
BTW, clang++ rejects it:
code0.cpp:2:10: error: 'friend' must appear first in a non-function declaration
class T friend;
^
code0.cpp:3:11: error: 'friend' must appear first in a non-function declaration
unsigned friend char;
^
2 errors generated.