Author Topic: type with auto and dynamic_cast<> not determined - C++  (Read 2725 times)

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: type with auto and dynamic_cast<> not determined - C++
« Reply #15 on: January 18, 2022, 10:37:30 PM »
Now it reproduces when I copy my entire original config dir to the new config dir INCLUDING all subdirectories.

I'll look into providing this to you. It may be very large.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: type with auto and dynamic_cast<> not determined - C++
« Reply #16 on: January 18, 2022, 10:50:09 PM »
I tarballed my entire 26.0.1 dir, including subdirs, and removed a few things. It still reproduces with this.

I sent a mail with a link to sstamp so he can download it and provide it to you.

I was only able to repro this by copying the entire 26.0.1 with its subdirs. I did this on Linux x64, so you'll probably have to do that too.

Also there are many 'vunxs2X.0.0.Xt.e/.ex' files in my config dir. Can I remove those? Seems like something brought over from a previous version? What are these files?

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: type with auto and dynamic_cast<> not determined - C++
« Reply #17 on: January 18, 2022, 10:51:51 PM »
An easier way would be to run the following from the command line (with the cursor on 'derivedClassObj')

codehelp-trace-symbol-info-help

You will get a slew of output to the debug window, hit Ctrl+X in the debug to cut it to the clipboard.

You could also to to each symbol in the sample file and do a Ctrl+Dot.  The only options should be what you see in the current file.  I suspect it is picking up code from one of your C/C++ tag files which is defining DerivedClass to something that ultimately typedefs down to "char".

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: type with auto and dynamic_cast<> not determined - C++
« Reply #18 on: January 19, 2022, 01:03:23 PM »
Look for codehelp.log on support.

I think whatever is in the tagfile should not impact this. 'auto' has the tightest scope and should override anything in tag files.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: type with auto and dynamic_cast<> not determined - C++
« Reply #19 on: January 19, 2022, 01:11:43 PM »
That log mentions /usr/include/rpcsvc/mount.h which has on the final line I post below (but not the final line of the file):

typedef char *name;

Don't know why SE is picking this up?

Code: [Select]
/*
 * Please do not edit this file.
 * It was generated using rpcgen.
 */

#ifndef _MOUNT_H_RPCGEN
#define _MOUNT_H_RPCGEN

#include <rpc/rpc.h>


#ifdef __cplusplus
extern "C" {
#endif

#define MNTPATHLEN 1024
#define MNTNAMLEN 255
#define FHSIZE 32

typedef char fhandle[FHSIZE];

struct fhstatus {
u_int fhs_status;
union {
fhandle fhs_fhandle;
} fhstatus_u;
};
typedef struct fhstatus fhstatus;

typedef char *dirpath;

typedef char *name;

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: type with auto and dynamic_cast<> not determined - C++
« Reply #20 on: January 19, 2022, 01:15:26 PM »
Things go haywire before that.  It picks up a #define for dynamic_cast from your Qt tag file.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: type with auto and dynamic_cast<> not determined - C++
« Reply #21 on: January 19, 2022, 01:40:56 PM »
I found below code in /usr/include/QtCore/qglobal.h.

It comes from tagfile: GCC-4.8.2-x86_64-redhat-linux.vtg

I added an #undef of QT_NO_DYNAMIC_CAST into preprocessing and rebuilt the GCC-4.8.2-x86_64-redhat-linux.vtg

Now it does find the right type, DerivedClass*

Strange thing is that there were other auto var = dynamic_cast<> in my codebase where the SE was correctly figuring out the type. Don't know why it worked sometimes and not others.

I suppose it is working now for me but would be nice is somehow SE got around this issue, or at least gave some indication to the user so they could easily find this issue and know to do an #undef.

Here is the code in /usr/include/QtCore/qglobal.h:

Code: [Select]
#ifdef QT_NO_DYNAMIC_CAST
#  define dynamic_cast QT_PREPEND_NAMESPACE(qt_dynamic_cast_check)

  template<typename T, typename X>
  T qt_dynamic_cast_check(X, T* = 0)
  { return T::dynamic_cast_will_always_fail_because_rtti_is_disabled; }
#endif

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: type with auto and dynamic_cast<> not determined - C++
« Reply #22 on: January 19, 2022, 04:55:16 PM »
I am adding the same #undef to the pre-configured preprocessing for the hot fix.

I am also going to double-fix it by specifically not allowing "dynamic_cast" to be expanded as a #define

I also found a separate tagging issue with anonymous enumerate types nested in classes which will be fixed in 26.0.2.

There will also be another issue with preprocessing addressed in 26.0.2.

The issue with the global typedef "name" is less fixable.  It is a legitimately defined global, SlickEdit cannot just ignore it, however, the code to avoid going down that path makes it a moot point anyway.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: type with auto and dynamic_cast<> not determined - C++
« Reply #23 on: January 19, 2022, 04:59:25 PM »
Thanks Dennis!