[Bug c++/108955] Ultimate++ fails with its specialized AssertMoveable

2023-02-27 Thread piotr5 at netscape dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108955

--- Comment #2 from piotr5 at netscape dot net ---
Created attachment 54549
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54549=edit
gunzip then: c++-13 -c delme-E13.cxx

also fails with c++-12 so the problem must be in the preprocessor...

[Bug c++/108955] New: Ultimate++ fails with its specialized AssertMoveable

2023-02-27 Thread piotr5 at netscape dot net via 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=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 
inline void AssertMoveablePtr(T, T) {}

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

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

template 
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 *)
{}
#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 *) {}
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?