public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/95197] libgomp/testsuite/libgomp.c++/for-27.C fails with -std=c++17
Date: Mon, 25 May 2020 14:38:21 +0000	[thread overview]
Message-ID: <bug-95197-4-NmIeXbJak2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95197-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95197

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase:

// { dg-do link }

typedef __PTRDIFF_TYPE__ ptrdiff_t;

template <typename T>
class I
{
public:
  typedef ptrdiff_t difference_type;
  I ();
  ~I ();
  I (T *);
  I (const I &);
  T &operator * ();
  T *operator -> ();
  T &operator [] (const difference_type &) const;
  I &operator = (const I &);
  I &operator ++ ();
  I operator ++ (int);
  I &operator -- ();
  I operator -- (int);
  I &operator += (const difference_type &);
  I &operator -= (const difference_type &);
  I operator + (const difference_type &) const;
  I operator - (const difference_type &) const;
  template <typename S> friend bool operator == (I<S> &, I<S> &);
  template <typename S> friend bool operator == (const I<S> &, const I<S> &);
  template <typename S> friend bool operator < (I<S> &, I<S> &);
  template <typename S> friend bool operator < (const I<S> &, const I<S> &);
  template <typename S> friend bool operator <= (I<S> &, I<S> &);
  template <typename S> friend bool operator <= (const I<S> &, const I<S> &);
  template <typename S> friend bool operator > (I<S> &, I<S> &);
  template <typename S> friend bool operator > (const I<S> &, const I<S> &);
  template <typename S> friend bool operator >= (I<S> &, I<S> &);
  template <typename S> friend bool operator >= (const I<S> &, const I<S> &);
  template <typename S> friend typename I<S>::difference_type operator - (I<S>
&, I<S> &);
  template <typename S> friend typename I<S>::difference_type operator - (const
I<S> &, const I<S> &);
  template <typename S> friend I<S> operator + (typename I<S>::difference_type
, const I<S> &);
private:
  T *p;
};
template <typename T> I<T>::I () : p (0) {}
template <typename T> I<T>::~I () {}
template <typename T> I<T>::I (T *x) : p (x) {}
template <typename T> I<T>::I (const I &x) : p (x.p) {}
template <typename T> T &I<T>::operator * () { return *p; }
template <typename T> T *I<T>::operator -> () { return p; }
template <typename T> T &I<T>::operator [] (const difference_type &x) const {
return p[x]; }
template <typename T> I<T> &I<T>::operator = (const I &x) { p = x.p; return
*this; }
template <typename T> I<T> &I<T>::operator ++ () { ++p; return *this; }
template <typename T> I<T> I<T>::operator ++ (int) { return I (p++); }
template <typename T> I<T> &I<T>::operator -- () { --p; return *this; }
template <typename T> I<T> I<T>::operator -- (int) { return I (p--); }
template <typename T> I<T> &I<T>::operator += (const difference_type &x) { p +=
x; return *this; }
template <typename T> I<T> &I<T>::operator -= (const difference_type &x) { p -=
x; return *this; }
template <typename T> I<T> I<T>::operator + (const difference_type &x) const {
return I (p + x); }
template <typename T> I<T> I<T>::operator - (const difference_type &x) const {
return I (p - x); }
template <typename T> bool operator == (I<T> &x, I<T> &y) { return x.p == y.p;
}
template <typename T> bool operator == (const I<T> &x, const I<T> &y) { return
x.p == y.p; }
template <typename T> bool operator != (I<T> &x, I<T> &y) { return !(x == y); }
template <typename T> bool operator != (const I<T> &x, const I<T> &y) { return
!(x == y); }
template <typename T> bool operator < (I<T> &x, I<T> &y) { return x.p < y.p; }
template <typename T> bool operator < (const I<T> &x, const I<T> &y) { return
x.p < y.p; }
template <typename T> bool operator <= (I<T> &x, I<T> &y) { return x.p <= y.p;
}
template <typename T> bool operator <= (const I<T> &x, const I<T> &y) { return
x.p <= y.p; }
template <typename T> bool operator > (I<T> &x, I<T> &y) { return x.p > y.p; }
template <typename T> bool operator > (const I<T> &x, const I<T> &y) { return
x.p > y.p; }
template <typename T> bool operator >= (I<T> &x, I<T> &y) { return x.p >= y.p;
}
template <typename T> bool operator >= (const I<T> &x, const I<T> &y) { return
x.p >= y.p; }
template <typename T> typename I<T>::difference_type operator - (I<T> &x, I<T>
&y) { return x.p - y.p; }
template <typename T> typename I<T>::difference_type operator - (const I<T> &x,
const I<T> &y) { return x.p - y.p; }
template <typename T> I<T> operator + (typename I<T>::difference_type x, const
I<T> &y) { return I<T> (x + y.p); }

void
bar (I<int> &a)
{
}

void
foo (const I<int> &a, const I<int> &b)
{
  I<int> i;
  #pragma omp distribute parallel for
  for (i = a; i < b; i++)
    bar (i);
}

int
main ()
{
  int a[64];
  foo (&a[0], &a[63]);
}

  parent reply	other threads:[~2020-05-25 14:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19  0:14 [Bug c++/95197] New: " mpolacek at gcc dot gnu.org
2020-05-25 14:23 ` [Bug c++/95197] " jakub at gcc dot gnu.org
2020-05-25 14:38 ` jakub at gcc dot gnu.org [this message]
2020-05-25 16:55 ` jakub at gcc dot gnu.org
2020-05-26  7:39 ` cvs-commit at gcc dot gnu.org
2020-06-14 10:07 ` cvs-commit at gcc dot gnu.org

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=bug-95197-4-NmIeXbJak2@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).