This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/46778] New: More SFINAE issues?


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

           Summary: More SFINAE issues?
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: paolo.carlini@oracle.com


I'm working on updating std::is_constructible and I see behavior I don't
understand for the current implementation. Shouldn't the below just compile???
(a more refined version of the code using std::declval<_Args1>(), etc, as in
<type_traits> doesn't change anything)

template<typename _Tp, typename... _Args>
  class is_constructible_mini
  {
    typedef char __one;
    typedef struct { char __arr[2]; } __two;

    template<typename _Tp1, typename... _Args1>
      static decltype(_Tp1(_Args1()...), __one())
      __test(int);

    template<typename, typename...>
      static __two __test(...);

  public:
    static const bool value = sizeof(__test<_Tp, _Args...>(0)) == 1;
  };

int t1[is_constructible_mini<int&>::value ? -1 : 1];
int t2[is_constructible_mini<const int&>::value ? -1 : 1];
int t3[is_constructible_mini<int&, int, int>::value ? -1 : 1]; // Ok
int t4[is_constructible_mini<const int&, int, int>::value ? -1 : 1];


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]