[Bug c++/55159] New: pythy constexpr auto lambda pointer has no initializer

2012-10-31 Thread supercilious.dude at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55159



 Bug #: 55159

   Summary: pythy constexpr auto lambda pointer has no initializer

Classification: Unclassified

   Product: gcc

   Version: unknown

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: supercilious.d...@gmail.com





Pythy (http://pfultz2.github.com/Pythy/) does something akin to:



template  

typename std::remove_reference::type *addr(T &&t) 

{ 

return &t; 

}



template 

struct min_t

{

constexpr static auto *f =

false ? addr([](T0 x, T1 y){ return x < y ? x : y; }) : nullptr; 

};



Which gcc (4.7.2 and 4.8.0 git master) cannot evaluate.

clang and visual studio 2012 work fine.



I know this is not strictly needed by gcc 4.8 since it has deduced auto without

the late specifier (which the other compilers lack), but its highly convenient

to have pythy work on all c++11 compilers.


[Bug c++/54101] New: Using std::declval for types without a default constructor and with a deleted copy constructor errors.

2012-07-26 Thread supercilious.dude at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54101

 Bug #: 54101
   Summary: Using std::declval for types without a default
constructor and with a deleted copy constructor
errors.
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: supercilious.d...@gmail.com


GCC rejects code which using std::declval on some types. From what I can
understand from the C++11 standard, such uses of declval are legal inside
decltype.

Clang accepts this without error. GCC 4.7.1 (and the current 4.8 from the
master branch of the git repository today)

Example:

#include 

class NonCopyable
{
  public:
// Not default constructable.
NonCopyable ( int )
{
}

NonCopyable ( NonCopyable const& ) = delete;
};


int main ( void )
{
  std::common_type::type t(0);
}

fails with:

In file included from
/home/user/install/VA-HEPHAESTUS/include/c++/4.8.0/bits/move.h:57:0,
 from
/home/user/install/VA-HEPHAESTUS/include/c++/4.8.0/bits/stl_pair.h:61,
 from
/home/user/install/VA-HEPHAESTUS/include/c++/4.8.0/utility:72,
 from gccbug.cxx:1:
/home/user/install/VA-HEPHAESTUS/include/c++/4.8.0/type_traits: In
instantiation of 'struct std::common_type':
gccbug.cxx:16:45:   required from here
/home/user/install/VA-HEPHAESTUS/include/c++/4.8.0/type_traits:1786:29: error:
use of deleted function 'NonCopyable::NonCopyable(const NonCopyable&)'
 { typedef decltype(true ? declval<_Tp>() : declval<_Up>()) type; };
 ^
gccbug.cxx:10:5: error: declared here
 NonCopyable ( NonCopyable const& ) = delete;
 ^
In file included from
/home/user/install/VA-HEPHAESTUS/include/c++/4.8.0/bits/move.h:57:0,
 from
/home/user/install/VA-HEPHAESTUS/include/c++/4.8.0/bits/stl_pair.h:61,
 from
/home/user/install/VA-HEPHAESTUS/include/c++/4.8.0/utility:72,
 from gccbug.cxx:1:
/home/user/install/VA-HEPHAESTUS/include/c++/4.8.0/type_traits:1786:29: error:
use of deleted function 'NonCopyable::NonCopyable(const NonCopyable&)'
 { typedef decltype(true ? declval<_Tp>() : declval<_Up>()) type; };
 ^
gccbug.cxx:10:5: error: declared here
 NonCopyable ( NonCopyable const& ) = delete;
 ^