Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
2c85439d
Commit
2c85439d
authored
Jul 21, 2019
by
Ignacio Etcheverry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it a build error if a GetTypeInfo specialization cannot be resolved
Previously it was a runtime error message.
parent
43793958
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
type_info.h
core/type_info.h
+7
-12
No files found.
core/type_info.h
View file @
2c85439d
...
...
@@ -83,15 +83,13 @@ enum Metadata {
};
}
// If the compiler fails because it's trying to instantiate the primary 'GetTypeInfo' template
// instead of one of the specializations, it's most likely because the type 'T' is not supported.
// If 'T' is a class that inherits 'Object', make sure it can see the actual class declaration
// instead of a forward declaration. You can always forward declare 'T' in a header file, and then
// include the actual declaration of 'T' in the source file where 'GetTypeInfo<T>' is instantiated.
template
<
class
T
,
typename
=
void
>
struct
GetTypeInfo
{
static
const
Variant
::
Type
VARIANT_TYPE
=
Variant
::
NIL
;
static
const
GodotTypeInfo
::
Metadata
METADATA
=
GodotTypeInfo
::
METADATA_NONE
;
static
inline
PropertyInfo
get_class_info
()
{
ERR_PRINT
(
"GetTypeInfo fallback. Bug!"
);
return
PropertyInfo
();
// Not "Nil", this is an error
}
};
struct
GetTypeInfo
;
#define MAKE_TYPE_INFO(m_type, m_var_type) \
template <> \
...
...
@@ -283,10 +281,7 @@ inline StringName __constant_get_enum_name(T param, const String &p_constant) {
return
GetTypeInfo
<
T
>::
get_class_info
().
class_name
;
}
#define CLASS_INFO(m_type) \
(GetTypeInfo<m_type *>::VARIANT_TYPE != Variant::NIL ? \
GetTypeInfo<m_type *>::get_class_info() : \
GetTypeInfo<m_type>::get_class_info())
#define CLASS_INFO(m_type) (GetTypeInfo<m_type *>::get_class_info())
#else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment