[Bug libstdc++/100384] Compiling in c++17 mode breaks compilation of functions named visit()

2021-05-03 Thread aacid at kde dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100384

--- Comment #2 from Albert Astals Cid  ---
People that know more C++ than me, told me

std::visit appears unconstrained to Variants...&& being actual std::variants
(in case you inherited one, I guess), so std::visit, as an unconstrained
perfect forwarder will win every overload set ranking. And std::visit is
brought in by ADL via std::vector

it's a misfeature, this has been adopted in C++23
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2162r2.html 

So I guess the proper resolution for this issue would be "not a bug", but will
leave you to decide on it :)

[Bug c++/100384] Compiling in c++17 mode breaks compilation of functions named visit()

2021-05-02 Thread aacid at kde dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100384

--- Comment #1 from Albert Astals Cid  ---
Created attachment 50734
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50734=edit
error log

[Bug c++/100384] New: Compiling in c++17 mode breaks compilation of functions named visit()

2021-05-02 Thread aacid at kde dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100384

Bug ID: 100384
   Summary: Compiling in c++17 mode breaks compilation of
functions named visit()
   Product: gcc
   Version: 10.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: aacid at kde dot org
  Target Milestone: ---

Created attachment 50733
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50733=edit
main.cpp

The attached code fails to compile with 

g++ --std=c++17 main.cpp 

I've tried with gcc 11.1 too and it fails too.

To me it seems a bug in the implementation in which std::visit is leaking into
the non std:: namespace, but maybe it's a bug in C++ specification?