[Bug c++/57565] New: variadic template and type inference failure

2013-06-07 Thread anass.lasram at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57565

Bug ID: 57565
   Summary: variadic template and type inference failure
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: anass.lasram at gmail dot com

Created attachment 30279
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30279&action=edit
sources, compiler details and command line

#include
#include

// #define DISABLE_COMPILE_ERROR

template
void bug()
{
#ifndef DISABLE_COMPILE_ERROR
auto tpl = std::make_tuple(t...); // doesn't compile but it should
#else
std::tuple tpl = std::make_tuple(t...);
#endif
std::cout << std::get<0>(tpl) << " , " << std::get<1>(tpl) << " , " <<
std::get<2>(tpl) << std::endl;
}


int main()
{
bug<10,20,30>();

return 0;
}


[Bug c++/57575] New: lvalue function accepted as an rvalue

2013-06-09 Thread anass.lasram at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57575

Bug ID: 57575
   Summary: lvalue function accepted as an rvalue
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: anass.lasram at gmail dot com

// the following code compiles but it should not

float f() { return 0.f; }

template
void take_f(F&& f) {}

int main()
{
// this is OK. reference collapsing 
take_f(f);

// next line compiles but it should not: f is not an rvalue !
take_f(f);

return 0;
}


[Bug c++/57575] lvalue function accepted as an rvalue

2013-06-10 Thread anass.lasram at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57575

Anass Lasram  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Anass Lasram  ---
(In reply to Daniel Krügler from comment #1)
> Your assumptions are mistaken. In C++ it is valid to bind a function value
> to an rvalue reference of that function type. It is only so, that binding to
> an lvalue reference is preferred.
> 
> In other words, the following is valid as well:
> 
> float f() { return 0.f; }
> float (&&r)(void) = f;
> 
> See for example [over.ics.ref] p3 (emphasis mine):
> 
> "Except for an implicit object parameter, for which see 13.3.1, a standard
> conversion sequence cannot be formed if it requires [..] binding an rvalue
> reference to an lvalue **other than a function lvalue**."


Thanks Daniel for the rectification.