Skip to content

Commit 36058d6

Browse files
committed
Fixed missing namespace if the type appears as a template parameter.
1 parent a4532a5 commit 36058d6

File tree

5 files changed

+51
-13
lines changed

5 files changed

+51
-13
lines changed

CodeGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4635,7 +4635,7 @@ void CodeGenerator::InsertTemplateArg(const TemplateArgument& arg)
46354635
case TemplateArgument::Template: [[fallthrough]];
46364636
case TemplateArgument::TemplateExpansion:
46374637
if(const auto* tmplDecl = arg.getAsTemplateOrTemplatePattern().getAsTemplateDecl()) {
4638-
mOutputFormatHelper.Append(GetName(*tmplDecl));
4638+
mOutputFormatHelper.Append(GetName(*tmplDecl, QualifiedName::Yes));
46394639

46404640
} else if(const auto* depName = arg.getAsTemplateOrTemplatePattern().getAsDependentTemplateName();
46414641
depName->isIdentifier()) {

tests/Namespace2Test.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Test
2+
{
3+
public:
4+
template<typename T>
5+
class my_array {};
6+
7+
// two type template parameters and one template template parameter:
8+
template<template<typename> typename C = my_array>
9+
class Map
10+
{
11+
};
12+
};
13+
14+
15+
int main(){
16+
Test::Map<> a;
17+
}

tests/Namespace2Test.expect

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
class Test
2+
{
3+
4+
public:
5+
template<typename T>
6+
class my_array
7+
{
8+
};
9+
10+
template<template <typename> typename C = my_array>
11+
class Map
12+
{
13+
};
14+
15+
/* First instantiated from: Namespace2Test.cpp:16 */
16+
#ifdef INSIGHTS_USE_TEMPLATE
17+
template<>
18+
class Map<my_array>
19+
{
20+
public:
21+
// inline constexpr Map() noexcept = default;
22+
};
23+
24+
#endif
25+
};
26+
27+
28+
int main()
29+
{
30+
Test::Map<Test::my_array> a;
31+
return 0;
32+
}

tests/NonTypeTemplateParameterPackTest.cerr

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/NonTypeTemplateParameterPackTest.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,6 @@ int main()
148148
{
149149
Test t;
150150
t.summ<int, int, int>(1, 2, 3);
151-
Test::Map<int, int, my_array> a;
151+
Test::Map<int, int, Test::my_array> a;
152152
return t.sum<1>();
153153
}

0 commit comments

Comments
 (0)