[Bug c++/83931] New: Add support for -nostdlib++

2018-01-18 Thread thomasanderson at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83931

Bug ID: 83931
   Summary: Add support for -nostdlib++
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: thomasanderson at google dot com
  Target Milestone: ---

Projects that want to link their own c++ standard library must currently pass
-nostdlib or -nodefaultlibs.  This means projects must add back -lm, -lc and so
on.  -nostdlib++ should be added (analogous to -nostdlib) for this use case.

LLVM added this feature in r308997 (https://reviews.llvm.org/rL308997), so gcc
should do the same.

[Bug c++/83931] Add support for -nostdlib++

2018-01-18 Thread thomasanderson at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83931

--- Comment #2 from Thomas Anderson  ---
From the LLVM CL description:

Alternatively, they could use clang instead
of clang++, but that already disables implicit addition of -lm on some
toolchains.

Not sure if this is the same for gcc though.

[Bug c++/81107] New: operator new(size_t) can't have hidden visibility

2017-06-15 Thread thomasanderson at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81107

Bug ID: 81107
   Summary: operator new(size_t) can't have hidden visibility
   Product: gcc
   Version: 6.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: thomasanderson at google dot com
  Target Milestone: ---

Created attachment 41559
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41559&action=edit
test.cpp

Compile the attached test.cpp with
$ g++ -fvisibility=hidden -nostdinc++ -std=c++11 -c test.cpp -o test.o

-fvisibility=hidden should make all symbols hidden, but operator new is not:

$ objdump -t test.o | grep _Znwm
 g F .text  000f _Znwm
000f g F .text  0013 .hidden _ZnwmRK9nothrow_t

Adding 'attribute((visibility("hidden")))' on operator new only raises an
error:

test.cpp: In function ‘void* operator new(size_t)’:
test.cpp:5:7: warning: ‘void* operator new(size_t)’: visibility attribute
ignored because it [-Wattributes]
 void* operator new(size_t size) { return (void*)1; }
   ^
:0:0: warning: conflicts with previous declaration here
[-Wattributes]

[Bug c++/81347] New: g++ confused by namespaces and friend classes

2017-07-06 Thread thomasanderson at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81347

Bug ID: 81347
   Summary: g++ confused by namespaces and friend classes
   Product: gcc
   Version: 5.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: thomasanderson at google dot com
  Target Milestone: ---

Created attachment 41695
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41695&action=edit
Preprocessed test.cpp

Compile test.cpp below using libc++ headers:

-test.cpp-
#include 

class C {
  std::set s;
};

#include 

using std::map;
--

$ g++ -c test.cpp -nostdinc++ -isystem/path/to/libc++/trunk/include

g++ fails to compile and gives:
main.cpp:9:12: error: ‘map’ is already declared in this scope
 using std::map;

I've attached a preprocessed output for convenience.

$ g++ -c test_preproc.cpp 2>/dev/null && echo pass || echo fail
fail
$ clang++ -c test_preproc.cpp 2>/dev/null && echo pass || echo fail
pass

[Bug c++/81107] operator new(size_t) can't have hidden visibility

2019-01-17 Thread thomasanderson at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81107

--- Comment #1 from Thomas Anderson  ---
Clang solved this recently by adding a -fvisibility-global-new-delete-hidden
option:
https://reviews.llvm.org/D53787