Surprising error when re-running a script that redefines a typedef first defined in a template

This post is a follow-up to my earlier post about sharing typedefs between templates and scripts.

The template and script provided below are minimized reproducers which
illustrate the subject of this post.

// File: test.bt
#define ATTR read
#define VAL testStr
typedef char myType <ATTR=VAL>;

myType b;

// The function below is needed when ATTR is "read" and VAL is "myTypeStr"
// Apart from having to exist, what it does isn't important.
string testStr( myType &b )
{
	return (b != false) ? "true" : "false"
}


// File: test.1sc

RunTemplate( "test.bt", true );
#define ATTR read
#define VAL testStr
typedef char myType <ATTR=VAL>;

myType b;

// The function below is needed when ATTR is "read" and VAL is "myTypeStr"
// Apart from having to exist, what it does isn't important.
string testStr( myType &b )
{
	return (b != false) ? "true" : "false"
}

Run test.1sc once, selecting some arbitrary unimportant file as the data file.
It runs without error.
Now, without clearing the Template Results window, run the script again.
I get the error:
*ERROR Line n: Redefinition of typedef did not match earlier typedef.

However, if first you do clear the Template Results window, no error occurs.

  • The typedef is exactly the same in the template and the script.
  • If the definition of ATTR is changed to to comment or name, there is no error.

At the time of posting I’m on a system lacking 010 Editor, so what’s above is a transcription and might not be error-free.

If they don’t actually do what I claim, I’ll fix them later.

It looks like there was a bug in comparing types when using the RunTemplate function and typedefs with read attributes. This update should hopefully fix the issue:

http://download.sweetscape.com/010EditorWin64Installer15.0.1c.exe

Graeme
SweetScape Software

Do you have a MacOS build with this fix ready to test?

Here’s the mac build:

http://download.sweetscape.com/010EditorMac64Installer15.0.1c.dmg

Graeme
SweetScape Software