[Bug c++/77815] New: access to destructor via decltype-specifier

2016-10-01 Thread jeff.mirwaisi at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77815

Bug ID: 77815
   Summary: access to destructor via decltype-specifier
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeff.mirwaisi at gmail dot com
  Target Milestone: ---

Invocation of the destructor or pseudo destructor via a decltype-specifier
results in an error:

T t; t.~decltype(t)();

error: expected identifier before 'decltype'

[Bug c++/77890] New: class template type deduction fails for lambda functions

2016-10-06 Thread jeff.mirwaisi at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77890

Bug ID: 77890
   Summary: class template type deduction fails for lambda
functions
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeff.mirwaisi at gmail dot com
  Target Milestone: ---

//error: 'S(F&&)-> S [with F = main(int, char**)::]', declared
using local 
//type 'main(int, char**)::', is used but never defined
template struct S{S(F&&f){}}; 
int main()
{
  S([]{});
}

//explicit deduction via a helper function works as expected
template struct S{S(F&&f){}}; 
template auto H(F&& f){return S(forward(f));}
int main()
{
  H([]{});
}

[Bug c++/77892] New: local function declarations don't match namespace scope declarations

2016-10-06 Thread jeff.mirwaisi at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77892

Bug ID: 77892
   Summary: local function declarations don't match namespace
scope declarations
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeff.mirwaisi at gmail dot com
  Target Milestone: ---

//error: undefined reference to 'f()'
struct S{friend void f(){}}; //lexical scope of S, only discoverable via ADL,
no 
 //argument, so not discoverable at all yet
void f(); //make f visible to ordinary qualified lookup
int main()
{
  void f(); //declaration should match the declaration at namespace scope,
instead   
//hides the previous declaration at namespace scope
  f(); 
} 

//open question whether a local scope declaration is enough to make a class
scope 
//friend function visible to ordinary lookup
//works in clang not in gcc
struct S{friend void f(){}};
int main()
{
  void f();
  f();
}

[Bug c++/77912] New: class template deduction fails in template functions and generic lambdas

2016-10-09 Thread jeff.mirwaisi at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77912

Bug ID: 77912
   Summary: class template deduction fails in template functions
and generic lambdas
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeff.mirwaisi at gmail dot com
  Target Milestone: ---

//deduction for the template type parameter of the simple class template below 
//fails when used in a generic context
template struct S{S(T){}}; 

//error: invalid use of template type parameter 'S'
template auto f(T t){return S(t);}

int main()
{
  //fails
  f(42);

  //fails
  //error: invalid use of template type parameter 'S'
  [](auto a){return S(a);}(42); 

  //works
  [](int a){return S(a);}(42);
}

[Bug c++/77912] [C++17 feature] class template deduction fails in template functions and generic lambdas

2016-10-10 Thread jeff.mirwaisi at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77912

Jeff Mirwaisi  changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|DUPLICATE   |---

--- Comment #3 from Jeff Mirwaisi  ---
(In reply to Markus Trippelsdorf from comment #2)
> dup.
> 
> *** This bug has been marked as a duplicate of bug 77890 ***

This is not a duplicate, in 77890 the lambda is the type to be deduced, in
77912, a generic lambda is the invoker of some class template which is expected
to deduce based on the generic argument

[Bug c++/77912] [C++17 feature] class template deduction fails in template functions and generic lambdas

2016-10-10 Thread jeff.mirwaisi at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77912

--- Comment #4 from Jeff Mirwaisi  ---
//To clarify:

template void f(T t){ S(t); } //deduction fails

int main()
{
  auto F=[]{};
  //bug 77890 - fails
  S(F); //this should construct a temporary object deduced as type
S



  //bug 77912 - fails
  [](auto A){ 
 S(A); //this should construct a temporary object deduced as type
S 
};
  //it is not the lambda type that is being used as a constructor argument, its
the 
  //generic parameter in the lambda function

  //worse yet, in the use of:
  f( 42 ); //within the body of the template function f, the deduction also
fails, an 
   //S should be deduced
}

[Bug c++/77890] class template type deduction fails for lambda functions

2016-10-10 Thread jeff.mirwaisi at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77890

--- Comment #3 from Jeff Mirwaisi  ---
Bug 77912 is not a duplicate of this bug (77890), please see 77912 for details,
unless 77890 is to be used as a general bug for all class template type
deduction issues - if not Vittorio Romeo's example of failure with respect to
local types should also be a standalone bug

[Bug c++/77927] New: unary right fold fails to compile

2016-10-10 Thread jeff.mirwaisi at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77927

Bug ID: 77927
   Summary: unary right fold fails to compile
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jeff.mirwaisi at gmail dot com
  Target Milestone: ---

//Unary right fold fails to compile

[Bug c++/77927] unary right fold fails to compile

2016-10-10 Thread jeff.mirwaisi at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77927

--- Comment #1 from Jeff Mirwaisi  ---
//unary right fold fails to compile
template void f(){int A[]={(((void)N,int()),...)};}

//corresponding left fold works as expected
template void f(){int A[]={(...,((void)N,int()))};}

//both are simple tests that generate a single element array int A[1]={0}

[Bug c++/77927] unary right fold fails to compile

2016-10-10 Thread jeff.mirwaisi at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77927

--- Comment #2 from Jeff Mirwaisi  ---
//error: binary expression in operand of fold-expression

[Bug c++/77927] unary right fold fails to compile

2016-10-10 Thread jeff.mirwaisi at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77927

--- Comment #3 from Jeff Mirwaisi  ---
Apologies for the poor bug report, to clarify, unary right folds which use a
binary 
operator in the fold parameter are failing to compile:

( (x op1 y) op2... );

//clearer examples - error: binary expression in operand of fold-expression
template void f1(){ ((N+1)+...); }
template void f2(){ ((1+N),...); }  
template void f3(){ ((N-1)*...); }

//op1 and op2 do not have to be the same operator

//the corresponding left folds compile as expected:
template void f4(){ (...+(1+N)); }