[Bug c++/70793] New: g++ does not accept some forms of "friend" declaration for builtin types

jpmarath at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Apr 25 20:39:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70793

            Bug ID: 70793
           Summary: g++ does not accept some forms of "friend" declaration
                    for builtin types
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jpmarath at gmail dot com
  Target Milestone: ---

This fails to compile:

struct S {
    friend short  ;
} s;

with gcc 5.3.1, the reported error is (compile with -std=c++14):

---
2 : error: friend declaration does not name a class or function
friend short ;
^
Compilation failed
---

The strange thing is that g++ accepts "friend short int;" :

struct S {
    friend short int;
} s;


clang++ 3.8 accepts both forms.


More information about the Gcc-bugs mailing list