public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52108] New: declval() with incomplete type
@ 2012-02-03 13:52 hidden_peak at mail dot ru
  2012-02-03 14:37 ` [Bug c++/52108] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hidden_peak at mail dot ru @ 2012-02-03 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52108
           Summary: declval() with incomplete type
    Classification: Unclassified
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hidden_peak@mail.ru


Created attachment 26563
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26563
bug illustration

Wrong report about 'incomplete type'. Situation has relation to type selection
technique.

Key string in the example is

template <class T>
static decltype( declval<typename T::pointer>(), declval<true_type>())
__test_p( int );

First declval (declval<typename T::pointer>) and comma operator required for
problem demonstration. Another condition is usage of x-pair<int,Incomplete>.


For testcase, see attached file. Compilation:

c++ -std=gnu++0x -c test.cc


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

* [Bug c++/52108] declval() with incomplete type
  2012-02-03 13:52 [Bug c++/52108] New: declval() with incomplete type hidden_peak at mail dot ru
@ 2012-02-03 14:37 ` redi at gcc dot gnu.org
  2012-04-18  9:10 ` abominable-snowman at yandex dot ru
  2012-04-18 10:36 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2012-02-03 14:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-02-03
     Ever Confirmed|0                           |1
      Known to fail|                            |4.6.2, 4.7.0

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-03 14:37:35 UTC ---
Confirmed, x_pair shouldn't be instantiated to form x_pair*

Reduced:

struct true_type { static const bool value = true; };
struct false_type { static const bool value = false; };

template <class T>
T&& declval() noexcept;

template <class T>
struct my_t_alloc_p
{
    typedef T  value_type;
    typedef value_type* pointer;       // <--- see Incomplete below
};

struct type_selector
{
#if 1
    // T::pointer should be present
    template <class T>
    static decltype( declval<typename T::pointer>(), declval<true_type>())
__test_p( int );
#else
    // If the declaration above re-write as below (worse, IMO), then it pass:
    template <class T>
    static decltype( T::pointer(), declval<true_type>() ) __test_p( int );
#endif

    template <class>
    static false_type __test_p( ... );
};

template <class Alloc>
struct x_allocator_traits
{
    typedef decltype(type_selector::__test_p<Alloc>(0)) pointer;
};

template <class A>
struct x_pair
{
    A a;
};

struct Incomplete
{
    typedef typename x_allocator_traits<my_t_alloc_p<x_pair<Incomplete> >
>::pointer pointer6;
};


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

* [Bug c++/52108] declval() with incomplete type
  2012-02-03 13:52 [Bug c++/52108] New: declval() with incomplete type hidden_peak at mail dot ru
  2012-02-03 14:37 ` [Bug c++/52108] " redi at gcc dot gnu.org
@ 2012-04-18  9:10 ` abominable-snowman at yandex dot ru
  2012-04-18 10:36 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: abominable-snowman at yandex dot ru @ 2012-04-18  9:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Petr Ovtchenkov <abominable-snowman at yandex dot ru> 2012-04-18 09:09:04 UTC ---
There are opinion, that this is not a bug:

http://llvm.org/bugs/show_bug.cgi?id=12583


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

* [Bug c++/52108] declval() with incomplete type
  2012-02-03 13:52 [Bug c++/52108] New: declval() with incomplete type hidden_peak at mail dot ru
  2012-02-03 14:37 ` [Bug c++/52108] " redi at gcc dot gnu.org
  2012-04-18  9:10 ` abominable-snowman at yandex dot ru
@ 2012-04-18 10:36 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-18 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-18 10:22:33 UTC ---
I agree with Richard's analysis, I hadn't thought of operator,


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

end of thread, other threads:[~2012-04-18 10:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-03 13:52 [Bug c++/52108] New: declval() with incomplete type hidden_peak at mail dot ru
2012-02-03 14:37 ` [Bug c++/52108] " redi at gcc dot gnu.org
2012-04-18  9:10 ` abominable-snowman at yandex dot ru
2012-04-18 10:36 ` redi at gcc dot gnu.org

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