-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for template instantiation #7
Draft
kunaltyagi
wants to merge
4
commits into
PointCloudLibrary:master
Choose a base branch
from
kunaltyagi:inst_func
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File: template <typename T>
struct AStruct { T value; };
template <typename T>
class AClass { const T privateValue; };
template <class T>
T aFunction(T&& aValue) { return aValue; }
template
struct AStruct<int>;
template
class AClass<char>;
template
bool aFunction<bool>(bool&&); AST dump: test.cpp:14:7: warning: class 'AClass<char>' does not declare any constructor to initialize its non-modifiable members
class AClass<char>;
^
test.cpp:14:7: note: in instantiation of template class 'AClass<char>' requested here
test.cpp:5:24: note: const member 'privateValue' will never be initialized
class AClass { const T privateValue; };
^
TranslationUnitDecl 0x559b7f467068 <<invalid sloc>> <invalid sloc>
|-TypedefDecl 0x559b7f467948 <<invalid sloc>> <invalid sloc> implicit __int128_t '__int128'
| `-BuiltinType 0x559b7f467600 '__int128'
|-TypedefDecl 0x559b7f4679b8 <<invalid sloc>> <invalid sloc> implicit __uint128_t 'unsigned __int128'
| `-BuiltinType 0x559b7f467620 'unsigned __int128'
|-TypedefDecl 0x559b7f467d40 <<invalid sloc>> <invalid sloc> implicit __NSConstantString '__NSConstantString_tag'
| `-RecordType 0x559b7f467aa0 '__NSConstantString_tag'
| `-CXXRecord 0x559b7f467a10 '__NSConstantString_tag'
|-TypedefDecl 0x559b7f467de8 <<invalid sloc>> <invalid sloc> implicit __builtin_ms_va_list 'char *'
| `-PointerType 0x559b7f467da0 'char *'
| `-BuiltinType 0x559b7f467100 'char'
|-TypedefDecl 0x559b7f4a5ce0 <<invalid sloc>> <invalid sloc> implicit __builtin_va_list '__va_list_tag [1]'
| `-ConstantArrayType 0x559b7f4a5c80 '__va_list_tag [1]' 1
| `-RecordType 0x559b7f467ed0 '__va_list_tag'
| `-CXXRecord 0x559b7f467e40 '__va_list_tag'
|-ClassTemplateDecl 0x559b7f4a5ea0 <test.cpp:1:1, line:2:27> col:8 AStruct
| |-TemplateTypeParmDecl 0x559b7f4a5d38 <line:1:11, col:20> col:20 referenced typename depth 0 index 0 T
| |-CXXRecordDecl 0x559b7f4a5e10 <line:2:1, col:27> col:8 struct AStruct definition
| | |-DefinitionData aggregate standard_layout trivially_copyable trivial
| | | |-DefaultConstructor exists trivial needs_implicit
| | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
| | | |-MoveConstructor exists simple trivial needs_implicit
| | | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
| | | |-MoveAssignment exists simple trivial needs_implicit
| | | `-Destructor simple irrelevant trivial needs_implicit
| | |-CXXRecordDecl 0x559b7f4a6108 <col:1, col:8> col:8 implicit struct AStruct
| | `-FieldDecl 0x559b7f4a61a8 <col:18, col:20> col:20 value 'T'
| `-ClassTemplateSpecialization 0x559b7f4a6a78 'AStruct'
|-ClassTemplateDecl 0x559b7f4a6340 <line:4:1, line:5:38> col:7 AClass
| |-TemplateTypeParmDecl 0x559b7f4a6210 <line:4:11, col:20> col:20 referenced typename depth 0 index 0 T
| |-CXXRecordDecl 0x559b7f4a62b0 <line:5:1, col:38> col:7 class AClass definition
| | |-DefinitionData standard_layout trivially_copyable trivial
| | | |-DefaultConstructor exists trivial needs_implicit
| | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
| | | |-MoveConstructor exists simple trivial needs_implicit
| | | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
| | | |-MoveAssignment exists trivial needs_implicit
| | | `-Destructor simple irrelevant trivial needs_implicit
| | |-CXXRecordDecl 0x559b7f4a65a8 <col:1, col:7> col:7 implicit class AClass
| | `-FieldDecl 0x559b7f4a6648 <col:16, col:24> col:24 privateValue 'const T'
| `-ClassTemplateSpecialization 0x559b7f4d54a8 'AClass'
|-FunctionTemplateDecl 0x559b7f4a6970 <line:7:1, line:8:42> col:3 aFunction
| |-TemplateTypeParmDecl 0x559b7f4a66b0 <line:7:11, col:17> col:17 referenced class depth 0 index 0 T
| |-FunctionDecl 0x559b7f4a68d0 <line:8:1, col:42> col:3 aFunction 'T (T &&)'
| | |-ParmVarDecl 0x559b7f4a67c0 <col:13, col:17> col:17 referenced aValue 'T &&'
| | `-CompoundStmt 0x559b7f4a6a48 <col:25, col:42>
| | `-ReturnStmt 0x559b7f4a6a38 <col:27, col:34>
| | `-DeclRefExpr 0x559b7f4a6a18 <col:34> 'T' lvalue ParmVar 0x559b7f4a67c0 'aValue' 'T &&'
| `-FunctionDecl 0x559b7f4d5bb8 <col:1, col:42> col:3 aFunction 'bool (bool &&)'
| |-TemplateArgument type 'bool'
| |-ParmVarDecl 0x559b7f4d5b28 <col:13, col:17> col:17 used aValue 'bool &&'
| `-CompoundStmt 0x559b7f4d5d00 <col:25, col:42>
| `-ReturnStmt 0x559b7f4d5cf0 <col:27, col:34>
| `-ImplicitCastExpr 0x559b7f4d5cd8 <col:34> 'bool':'bool' <LValueToRValue>
| `-DeclRefExpr 0x559b7f4d5cb8 <col:34> 'bool':'bool' lvalue ParmVar 0x559b7f4d5b28 'aValue' 'bool &&'
|-ClassTemplateSpecializationDecl 0x559b7f4a6a78 <line:10:1, line:11:19> col:8 struct AStruct definition
| |-DefinitionData pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal
| | |-DefaultConstructor exists trivial needs_implicit
| | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
| | |-MoveConstructor exists simple trivial needs_implicit
| | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
| | |-MoveAssignment exists simple trivial needs_implicit
| | `-Destructor simple irrelevant trivial needs_implicit
| |-TemplateArgument type 'int'
| |-CXXRecordDecl 0x559b7f4d5358 prev 0x559b7f4a6a78 <line:2:1, col:8> col:8 implicit struct AStruct
| `-FieldDecl 0x559b7f4d5430 <col:18, col:20> col:20 value 'int':'int'
`-ClassTemplateSpecializationDecl 0x559b7f4d54a8 <line:13:1, line:14:18> col:7 class AClass definition
|-DefinitionData pass_in_registers standard_layout trivially_copyable trivial literal
| |-DefaultConstructor exists trivial needs_implicit
| |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
| |-MoveConstructor exists simple trivial needs_implicit
| |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
| |-MoveAssignment exists trivial needs_implicit
| `-Destructor simple irrelevant trivial needs_implicit
|-TemplateArgument type 'char'
|-CXXRecordDecl 0x559b7f4d56b0 prev 0x559b7f4d54a8 <line:5:1, col:7> col:7 implicit class AClass
`-FieldDecl 0x559b7f4d5780 <col:16, col:24> col:24 privateValue 'const char':'const char'
1 warning generated. |
Let's merge #6 first and then solve this issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Required for template heavy library like PCL
Currently fails to detect function template instantiation
@divmadan help please 😄