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

* [Bug c++/46778] More SFINAE issues?
  2010-12-03 11:19 [Bug c++/46778] New: More SFINAE issues? paolo.carlini at oracle dot com
@ 2010-12-03 11:20 ` paolo.carlini at oracle dot com
  2010-12-03 11:32 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-12-03 11:20 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-12-03 11:19:52 UTC ---
I'm adding Jason in CC.


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

* [Bug c++/46778] More SFINAE issues?
  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
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2010-12-03 11:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-12-03 11:32:00 UTC ---
the test looks valid to me, this simpler version is also rejected

template<typename _Tp>
  class is_constructible_mini2
  {
    typedef char __one;
    typedef struct { char __arr[2]; } __two;

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

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

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

int t1[is_constructible_mini2<int&>::value ? -1 : 1];
int t2[is_constructible_mini2<const int&>::value ? -1 : 1];


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

* [Bug c++/46778] More SFINAE issues?
  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
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-12-17 17:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-12-17 17:40:46 UTC ---
Jason, sorry for bothering: I would be interested in knowing in particular your
opinion about t4, where is_constructible_mini "returns" true, that is, isn't
just that errors are not suppressed (ie, more than just tsubst_flags_t
arguments not propagated)


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

* [Bug c++/46778] More SFINAE issues?
  2010-12-03 11:19 [Bug c++/46778] New: More SFINAE issues? paolo.carlini at oracle dot com
                   ` (2 preceding siblings ...)
  2010-12-17 17:40 ` paolo.carlini at oracle dot com
@ 2011-05-08 14:49 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-05-08 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-05-08 14:47:54 UTC ---
Already fixed in mainline.


^ 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).