public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108955] New: Ultimate++ fails with its specialized AssertMoveable
@ 2023-02-27 19:56 piotr5 at netscape dot net
  2023-02-27 20:03 ` [Bug c++/108955] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: piotr5 at netscape dot net @ 2023-02-27 19:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108955
           Summary: Ultimate++ fails with its specialized AssertMoveable
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: piotr5 at netscape dot net
  Target Milestone: ---

Created attachment 54548
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54548&action=edit
my failed attempt at a minimal example after preprocessor

I'm on gentoo with sys-devel/gcc-13.0.1_pre20230219 and tried to recompile
anything using Ultimate++ from upp.sf.net and already the heaqders fail to
compile. error: invalid type argument of unary '*' (have 'unsigned int')

this indicates the pre-c++11 test for "unsigned int" being a moveable data-type
failed. I tried to reproduce the problem with a minimal example but that had no
such problems in compilation. the way it's supposed to work is Core/Topt.h:
```
template <class T>
inline void AssertMoveablePtr(T, T) {}

template <class T>
inline void AssertMoveable0(T *t) { AssertMoveablePtr(&**t, *t); }
// COMPILATION ERROR HERE MEANS TYPE T WAS NOT MARKED AS Moveable

template <class T>
struct Moveable_ {
        friend void AssertMoveable0(T *) {}
};

template <class T>
inline void AssertMoveable(T *t = 0) { if(t) AssertMoveable0(t); }

#if defined(COMPILER_MSC) || defined(COMPILER_GCC) && (__GNUC__ < 4 ||
__GNUC_MINOR__ < 1)
        #define NTL_MOVEABLE(T) inline void AssertMoveable0(T *) {}
#else
        #define NTL_MOVEABLE(T) template<> inline void AssertMoveable<T>(T *)
{}
#endif


NTL_MOVEABLE(bool)
NTL_MOVEABLE(char)
NTL_MOVEABLE(signed char)
NTL_MOVEABLE(unsigned char)
NTL_MOVEABLE(short)
NTL_MOVEABLE(unsigned short)
NTL_MOVEABLE(int)
NTL_MOVEABLE(unsigned int)
NTL_MOVEABLE(long)
NTL_MOVEABLE(unsigned long)
NTL_MOVEABLE(int64)
NTL_MOVEABLE(uint64)
NTL_MOVEABLE(float)
NTL_MOVEABLE(double)
NTL_MOVEABLE(void *)
NTL_MOVEABLE(const void *)
```
then in destructor for Vector there is

AssertMoveable((T *)0);

where T = unsigned int

what is supposed to happen is that NTL_MOVEABLE expands to
template<> inline void AssertMoveable<T>(T *) {}
so far it works as expected. however upon encontering that AssertMoveable((T
*)0); it is expanded into
inline void AssertMoveable0(T *t) { AssertMoveablePtr(&**t, *t); }
instead. is it because that was defined in the wrong order? but then why did my
minimal example work? why is there no such problem with gcc-12?

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

end of thread, other threads:[~2023-02-27 20:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 19:56 [Bug c++/108955] New: Ultimate++ fails with its specialized AssertMoveable piotr5 at netscape dot net
2023-02-27 20:03 ` [Bug c++/108955] " pinskia at gcc dot gnu.org
2023-02-27 20:19 ` piotr5 at netscape dot net
2023-02-27 20:32 ` pinskia at gcc dot gnu.org
2023-02-27 20:36 ` pinskia 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).