public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46778] New: More SFINAE issues?
@ 2010-12-03 11:19 paolo.carlini at oracle dot com
  2010-12-03 11:20 ` [Bug c++/46778] " paolo.carlini at oracle dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-12-03 11:19 UTC (permalink / raw)
  To: gcc-bugs

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];


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-08 14:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-03 11:19 [Bug c++/46778] New: More SFINAE issues? paolo.carlini at oracle dot com
2010-12-03 11:20 ` [Bug c++/46778] " paolo.carlini at oracle dot com
2010-12-03 11:32 ` redi at gcc dot gnu.org
2010-12-17 17:40 ` paolo.carlini at oracle dot com
2011-05-08 14:49 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).