public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: johnb@stl.sarov.ru
To: gcc-gnats@gcc.gnu.org
Subject: libstdc++/8780: std::vector iterators not recognized as pointers by templates in certain cases
Date: Mon, 02 Dec 2002 01:06:00 -0000	[thread overview]
Message-ID: <20021202090456.10057.qmail@sources.redhat.com> (raw)


>Number:         8780
>Category:       libstdc++
>Synopsis:       std::vector iterators not recognized as pointers by templates in certain cases
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 02 01:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Eugeny Belov
>Release:        g++ (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
>Organization:
>Environment:
Red Hat Linux 8.0.
>Description:
  The attached testcase code uses STL to check whether the type given in the template specification of is_pointer_helper (in this case std::vector<int>::iterator) is a pointer type. (See also ISO\IEC 14882, 24.1.(1,2))
  So, trying to compile this testcase by g++ I get the error messages:
tr18877.cpp: In function `int main()':
tr18877.cpp:37: `sizeof' applied to incomplete type `
   STATIC_ASSERTION_FAILURE<false>'
tr18877.cpp:37: declaration does not declare anything
  The first error occure due the vector<int> iterator isn`t a pointer type, the second warning is legitimate.

>How-To-Repeat:
Try to compile the testcase with g++.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="veciter.cpp"
Content-Disposition: inline; filename="veciter.cpp"

#include <vector>
//#include <list>

template<int> struct static_assert_test{};

template <bool> struct STATIC_ASSERTION_FAILURE;
template <> struct STATIC_ASSERTION_FAILURE<true>{};

#define BOOST_STATIC_ASSERT( B ) static_assert_test<sizeof(STATIC_ASSERTION_FAILURE< ( B ) >)>

template <typename T> struct is_pointer_helper
{ static const bool value = false; };
template <typename T> struct is_pointer_helper<T*>
{ static const bool value = true; };
template <typename T> struct is_pointer_helper<T*const>
{ static const bool value = true; };
template <typename T> struct is_pointer_helper<T*volatile>
{ static const bool value = true; };
template <typename T> struct is_pointer_helper<T*const volatile>
{ static const bool value = true; };


int main(void)
{
	BOOST_STATIC_ASSERT(is_pointer_helper<std::vector<int>::iterator>::value);

	return(0);
}


             reply	other threads:[~2002-12-02  9:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-02  1:06 johnb [this message]
2002-12-02  5:31 paolo
2002-12-04 10:24 paolo
2002-12-04 10:26 Joe Buck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021202090456.10057.qmail@sources.redhat.com \
    --to=johnb@stl.sarov.ru \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).