[Bug c++/49251] [C++0x][parameter pack expanding] unused parameter warning with unpacking empty tuples

2018-10-28 Thread logicstuffs at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49251

LogicStuff  changed:

   What|Removed |Added

 CC||logicstuffs at gmail dot com

--- Comment #6 from LogicStuff  ---
#include 

template< std::size_t... Indices >
struct indices {};

template< class... Args >
void sink( Args&&... ) {}

template< class Tuple, std::size_t... Indices >
void unpack_test( Tuple t, indices ) {
  sink( std::get(t)... );
}

int main() {
  unpack_test( std::tuple<>(), indices<>() );
}



With the small change in the signature (notice passing `t` by value), is this
warning acceptable?

bug.cc: In instantiation of 'void unpack_test(Tuple, indices)
[with Tuple = std::tuple<>; long unsigned int ...Indices = {}]':
bug.cc:15:44:   required from here
bug.cc:10:25: warning: parameter 't' set but not used
[-Wunused-but-set-parameter]
 void unpack_test( Tuple t, indices ) {
 ^

Observed with various versions from 4.4.7 to 9.0.0 201810. Not observed with
Clang.

[Bug c++/88123] New: faulty qualified name lookup of overloaded operator within generic lambda via using-directive

2018-11-20 Thread logicstuffs at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88123

Bug ID: 88123
   Summary: faulty qualified name lookup of overloaded operator
within generic lambda via using-directive
   Product: gcc
   Version: 6.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: logicstuffs at gmail dot com
  Target Milestone: ---

Consider this code:

struct bar {};

namespace foo
{
void operator+(bar) {}
} // namespace foo

int main()
{
using namespace foo;

auto l = [](auto x) { +x; };
l(bar());
}

Somewhere between versions 5.5.0 and 6.1.0 (not tested with 6.0), the operator+
(binary too) lookup inside starts to fail, and fails ever since. That is, in
the exact form as posted above.

The code compiles, if we do ANY of the following:
- refactor operator+ into a regular function
- put bar class in foo namespace
- make the lambda non-generic
- make the operator+ argument non-generic, i.e. auto l = [](auto) { +bar(); };
- change using-directive into using-declaration, i.e. using foo::operator+;
- put the using namespace directive inside the lambda's body

The inheritance mechanism of the available names in the scope of the lambda
from the outer scope seems to be broken.