View Issue Details

IDProjectCategoryView StatusLast Update
0001843NoesisGUIC++ SDKpublic2020-12-01 18:26
ReporterCravenWarrior3 Assigned Tojsantos  
PrioritynormalSeveritytweak 
Status resolvedResolutionfixed 
Product Version3.0.7 
Target Version3.0.8Fixed in Version3.0.8 
Summary0001843: Missing "template" statements in TypePropertyUtil.h
Description

Partly into compiling a game which uses NoesisGUI, errors with the "expect primary-expression before 'char' token" format are thrown. Lines 34, 40, 46, 47, 66, 72, 84, and 90 of Include/NsCore/TypePropertyUtil.h are referenced in the error message.

Adding "template" to the appropriate location on each line fixes the error and ensures successful compilation of the program afterwards. The issue is relatively minor and simple to fix although no other files generated the error message.

Steps To Reproduce

Discovered the issue while attempting to compile Ingnomia on Ubuntu 20.10, NoesisGUI was compiled using the Debug setting.

Attached Files
Log.txt (4,434 bytes)   
Scanning dependencies of target NoesisApp
make[2]: Leaving directory '/mnt/ssd/Projects/Ingnomia/build'
make[2]: Entering directory '/mnt/ssd/Projects/Ingnomia/build'
[ 17%] Building CXX object 3rdparty/NoesisApp/CMakeFiles/NoesisApp.dir/cmake_pch.hxx.gch
In file included from /mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NoesisPCH.h:14,
                 from /mnt/ssd/Projects/Ingnomia/3rdparty/NoesisApp/pch.h:2,
                 from /mnt/ssd/Projects/Ingnomia/build/3rdparty/NoesisApp/CMakeFiles/NoesisApp.dir/cmake_pch.hxx:5,
                 from <command-line>:
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h: In function ‘Noesis::Ptr<Noesis::BaseComponent> Noesis::GetComponent(const Noesis::TypeProperty*, const void*, Noesis::NonRefCountedType)’:
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h:34:35: error: expected primary-expression before ‘>’ token
   34 |     return Boxing::Box(prop->Get<T>(ptr));
      |                                   ^
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h: In function ‘Noesis::Ptr<Noesis::BaseComponent> Noesis::GetComponent(const Noesis::TypeProperty*, const void*, Noesis::PtrRefCountedType)’:
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h:40:53: error: expected primary-expression before ‘>’ token
   40 |     return DynamicPtrCast<BaseComponent>(prop->Get<T>(ptr));
      |                                                     ^
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h: In function ‘Noesis::Ptr<Noesis::BaseComponent> Noesis::GetComponent(const Noesis::TypeProperty*, const void*, Noesis::PointerRefCountedType)’:
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h:46:30: error: expected primary-expression before ‘(’ token
   46 |     return Ptr<BaseComponent>(const_cast<BaseComponent*>(
      |                              ^
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h:47:54: error: expected primary-expression before ‘>’ token
   47 |         DynamicCast<const BaseComponent*>(prop->Get<T>(ptr))));
      |                                                      ^
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h: In function ‘void Noesis::SetComponent(const Noesis::TypeProperty*, void*, Noesis::BaseComponent*, Noesis::NonCharPointerType)’:
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h:66:16: error: expected primary-expression before ‘>’ token
   66 |     prop->Set<T>(ptr, value != 0 ? Boxing::Unbox<T>(value) : T());
      |                ^
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h: In function ‘void Noesis::SetComponent(const Noesis::TypeProperty*, void*, Noesis::BaseComponent*, Noesis::CharPointerType)’:
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h:72:16: error: expected primary-expression before ‘>’ token
   72 |     prop->Set<T>(ptr, value != 0 ? Boxing::Unbox<String>(value).Str() : "");
      |                ^
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h: In function ‘void Noesis::SetComponent(const Noesis::TypeProperty*, void*, Noesis::BaseComponent*, Noesis::PtrRefCountedType)’:
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h:84:16: error: expected primary-expression before ‘>’ token
   84 |     prop->Set<T>(ptr, T(DynamicCast<typename T::Type*>(value)));
      |                ^
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h: In function ‘void Noesis::SetComponent(const Noesis::TypeProperty*, void*, Noesis::BaseComponent*, Noesis::PointerRefCountedType)’:
/mnt/ssd/Projects/Dependencies/NoesisGUI/Include/NsCore/TypePropertyUtil.h:90:16: error: expected primary-expression before ‘>’ token
   90 |     prop->Set<T>(ptr, DynamicCast<T>(value));
      |                ^
make[2]: *** [3rdparty/NoesisApp/CMakeFiles/NoesisApp.dir/build.make:252: 3rdparty/NoesisApp/CMakeFiles/NoesisApp.dir/cmake_pch.hxx.gch] Error 1
make[2]: Leaving directory '/mnt/ssd/Projects/Ingnomia/build'
make[1]: *** [CMakeFiles/Makefile2:312: 3rdparty/NoesisApp/CMakeFiles/NoesisApp.dir/all] Error 2
make[1]: Leaving directory '/mnt/ssd/Projects/Ingnomia/build'
make: *** [Makefile:130: all] Error 2
Log.txt (4,434 bytes)   
TypePropertyUtil.h (3,643 bytes)   
////////////////////////////////////////////////////////////////////////////////////////////////////
// NoesisGUI - http://www.noesisengine.com
// Copyright (c) 2013 Noesis Technologies S.L. All Rights Reserved.
////////////////////////////////////////////////////////////////////////////////////////////////////


#ifndef __CORE_TYPEPROPERTYUTIL_H__
#define __CORE_TYPEPROPERTYUTIL_H__


#include <NsCore/Noesis.h>
#include <NsCore/CompilerTools.h>
#include <NsCore/String.h>
#include <NsCore/Boxing.h>


namespace Noesis
{

typedef Int2Type<0> NonRefCountedType;
typedef Int2Type<1> PtrRefCountedType;
typedef Int2Type<2> PointerRefCountedType;

typedef Int2Type<3> NonCharPointerType;
typedef Int2Type<4> CharPointerType;

////////////////////////////////////////////////////////////////////////////////////////////////////
/// Auxiliary functions to get values from a property using boxed values or Ptr objects
////////////////////////////////////////////////////////////////////////////////////////////////////
//@{
template<class T>
Ptr<BaseComponent> GetComponent(const TypeProperty* prop, const void* ptr, NonRefCountedType)
{
    return Boxing::Box(prop->template Get<T>(ptr));
}

template<class T>
Ptr<BaseComponent> GetComponent(const TypeProperty* prop, const void* ptr, PtrRefCountedType)
{
    return DynamicPtrCast<BaseComponent>(prop->template Get<T>(ptr));
}

template<class T>
Ptr<BaseComponent> GetComponent(const TypeProperty* prop, const void* ptr, PointerRefCountedType)
{
    return Ptr<BaseComponent>(const_cast<BaseComponent*>(
        DynamicCast<const BaseComponent*>(prop->template Get<T>(ptr))));
}

template<class T>
Ptr<BaseComponent> GetComponent(const TypeProperty* prop, const void* ptr)
{
    typedef RemovePointer<T> PointedType;
    enum { IsRefCountedType = IsPtr<T>::Result ? 1 : IsRefCounted<PointedType>::Result ? 2 : 0 };
    return GetComponent<T>(prop, ptr, Int2Type<IsRefCountedType>());
}
//@}

////////////////////////////////////////////////////////////////////////////////////////////////////
/// Auxiliary functions to set values in a property using boxed values or Ptr objects
////////////////////////////////////////////////////////////////////////////////////////////////////
//@{
template<class T>
void SetComponent(const TypeProperty* prop, void* ptr, BaseComponent* value, NonCharPointerType)
{
    prop->template Set<T>(ptr, value != 0 ? Boxing::Unbox<T>(value) : T());
}

template<class T>
void SetComponent(const TypeProperty* prop, void* ptr, BaseComponent* value, CharPointerType)
{
    prop->template Set<T>(ptr, value != 0 ? Boxing::Unbox<String>(value).Str() : "");
}

template<class T>
void SetComponent(const TypeProperty* prop, void* ptr, BaseComponent* value, NonRefCountedType)
{
    SetComponent<T>(prop, ptr, value, Int2Type<(int)IsSame<T, const char*>::Result + 3>());
}

template<class T>
void SetComponent(const TypeProperty* prop, void* ptr, BaseComponent* value, PtrRefCountedType)
{
    prop->template Set<T>(ptr, T(DynamicCast<typename T::Type*>(value)));
}

template<class T>
void SetComponent(const TypeProperty* prop, void* ptr, BaseComponent* value, PointerRefCountedType)
{
    prop->template Set<T>(ptr, DynamicCast<T>(value));
}

template<class T>
void SetComponent(const TypeProperty* prop, void* ptr, BaseComponent* value)
{
    typedef RemovePointer<T> PointedType;
    enum { IsRefCountedType = IsPtr<T>::Result ? 1 : IsRefCounted<PointedType>::Result ? 2 : 0 };
    SetComponent<T>(prop, ptr, value, Int2Type<IsRefCountedType>());
}
//@}

}

#endif
TypePropertyUtil.h (3,643 bytes)   
PlatformLinux

Activities

jsantos

jsantos

2020-11-26 10:53

manager   ~0006824

Could you please indicate gcc version and, if possible, a patch with the changes? Thanks!

CravenWarrior3

CravenWarrior3

2020-11-26 15:23

reporter   ~0006829

I'm using version 10.2.0 of gcc. Here's the edited file that fixes the issue I'm having.

jsantos

jsantos

2020-12-01 18:26

manager   ~0006852

Thanks for this!

Issue History

Date Modified Username Field Change
2020-11-26 05:33 CravenWarrior3 New Issue
2020-11-26 05:33 CravenWarrior3 Tag Attached: C++
2020-11-26 05:33 CravenWarrior3 File Added: Log.txt
2020-11-26 10:49 jsantos Assigned To => jsantos
2020-11-26 10:49 jsantos Status new => assigned
2020-11-26 10:49 jsantos Target Version => 3.0.8
2020-11-26 10:53 jsantos Status assigned => feedback
2020-11-26 10:53 jsantos Note Added: 0006824
2020-11-26 15:23 CravenWarrior3 File Added: TypePropertyUtil.h
2020-11-26 15:23 CravenWarrior3 Note Added: 0006829
2020-11-26 15:23 CravenWarrior3 Status feedback => assigned
2020-12-01 18:26 jsantos Note Added: 0006852
2020-12-01 18:26 jsantos Status assigned => resolved
2020-12-01 18:26 jsantos Resolution open => fixed
2020-12-01 18:26 jsantos Fixed in Version => 3.0.8