[Bug c++/87178] New: Compilation failure when program contains multiple variables allocated in particular section, and at least one variable is C++17 "inline"

2018-08-31 Thread jpmarath at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87178

Bug ID: 87178
   Summary: Compilation failure when program contains multiple
variables allocated in particular section, and at
least one variable is C++17 "inline"
   Product: gcc
   Version: 9.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 program fails to compile:
//--
inline __attribute__((section("foo"))) int xxx;
__attribute__((section("foo"))) int yyy;

int *p1 = &xxx;
int *p2 = &yyy;
//--


$g++ -std=c++17 -c m1.cpp

:2:37: error: 'yyy' causes a section type conflict with 'xxx'

2 | __attribute__((section("foo"))) int yyy;

  | ^~~

:1:44: note: 'xxx' was declared here

1 | inline __attribute__((section("foo"))) int xxx;

  |^~~


The same program compile fine with clang (checked with clang 6.0)

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

2016-04-25 Thread jpmarath at gmail dot com
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.