This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/84782] New: Rejects a maybe C++ code snippet


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

            Bug ID: 84782
           Summary: Rejects a maybe C++ code snippet
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jason at gcc dot gnu.org
  Target Milestone: ---

We reject:

$ cat playback_image_provider.ii
template <typename a, a b> struct c { static constexpr a d = b; };
template <typename a> a ac();
template <typename a, typename e> class f {
  template <typename g, typename, typename = decltype(ac<g>() = ac)>
  void h(int);
  template <typename, typename> static c<bool, false> h(...);

public:
  typedef decltype(h<a, e>(0)) i;
};
template <typename a> struct j : f<a, int>::i {};
class k {
public:
  k(const k &);
  void operator=(k &&);
};
class l : k {
  using ae = k;
  using ae::operator=;
};
template <int> struct m {};
template <typename af> class n : m<j<af>::d> {};
class o {
  struct G {
    G(const G &);
    l q;
  };
  n<G> p;
};
o::G::G(const G &) = default;

$ g++ -c playback_image_provider.ii
playback_image_provider.ii:30:1: note: ‘o::G::G(const o::G&)’ is implicitly
deleted because the default definition would be ill-formed:
 o::G::G(const G &) = default;
 ^
playback_image_provider.ii:30:1: error: use of deleted function ‘l::l(const
l&)’
playback_image_provider.ii:17:7: note: ‘l::l(const l&)’ is implicitly declared
as deleted because ‘l’ declares a move constructor or move assignment operator
 class l : k {
       ^

However clang accepts:

$ clang++ -c playback_image_provider.ii -std=c++11

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]