forked from llvm-mirror/clang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ODRHash] Support TemplateName and TemplateArgument
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303450 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
1 parent
03e56f3
commit aba3b84
Showing
2 changed files
with
192 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -866,6 +866,108 @@ S9 s9; | |
#endif | ||
} | ||
|
||
namespace TemplateArgument { | ||
#if defined(FIRST) | ||
template <typename ...T> struct A1 {}; | ||
struct S1 { | ||
A1<int> x; | ||
}; | ||
#elif defined(SECOND) | ||
template <typename ...T> struct A1 {}; | ||
struct S1 { | ||
A1<int, int> x; | ||
}; | ||
#else | ||
S1 s1; | ||
// [email protected]:* {{'TemplateArgument::S1::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S1' in module 'SecondModule'}} | ||
// [email protected]:* {{declaration of 'x' does not match}} | ||
#endif | ||
|
||
#if defined(FIRST) | ||
template <typename T> struct A2 {}; | ||
struct S2 { | ||
A2<int> x; | ||
}; | ||
#elif defined(SECOND) | ||
template <typename T> struct A2 {}; | ||
struct S2 { | ||
A2<short> x; | ||
}; | ||
#else | ||
S2 s2; | ||
// [email protected]:* {{'TemplateArgument::S2::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S2' in module 'SecondModule'}} | ||
// [email protected]:* {{declaration of 'x' does not match}} | ||
#endif | ||
|
||
#if defined(FIRST) | ||
template <typename T> struct A3 {}; | ||
struct S3 { | ||
A3<int> x; | ||
}; | ||
#elif defined(SECOND) | ||
template <typename T> struct B3 {}; | ||
struct S3 { | ||
B3<int> x; | ||
}; | ||
#else | ||
S3 s3; | ||
// [email protected]:* {{'TemplateArgument::S3::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S3' in module 'SecondModule'}} | ||
// [email protected]:* {{declaration of 'x' does not match}} | ||
#endif | ||
|
||
#if defined(FIRST) | ||
template <typename T, T t> struct A4 {}; | ||
struct S4 { | ||
A4<int, 5> x; | ||
}; | ||
#elif defined(SECOND) | ||
template <typename T, T t> struct A4 {}; | ||
struct S4 { | ||
A4<int, 5 + 0> x; | ||
}; | ||
#else | ||
S4 s4; | ||
// [email protected]:* {{'TemplateArgument::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'A4<int, 5 + 0>'}} | ||
// [email protected]:* {{but in 'FirstModule' found field 'x' with type 'A4<int, 5>'}} | ||
#endif | ||
|
||
#if defined(FIRST) | ||
int x5; | ||
template <int *ptr> struct A5 {}; | ||
struct S5 { | ||
A5<nullptr> x; | ||
}; | ||
#elif defined(SECOND) | ||
int x5; | ||
template <int *ptr> struct A5 {}; | ||
struct S5 { | ||
A5<&x5> x; | ||
}; | ||
#else | ||
S5 s5; | ||
// [email protected]:* {{'TemplateArgument::S5::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S5' in module 'SecondModule'}} | ||
// [email protected]:* {{declaration of 'x' does not match}} | ||
#endif | ||
|
||
#if defined(FIRST) | ||
int x6; | ||
template <int *ptr> struct A6 {}; | ||
struct S6 { | ||
A6<&x6> x; | ||
}; | ||
#elif defined(SECOND) | ||
int y6; | ||
template <int *ptr> struct A6 {}; | ||
struct S6 { | ||
A6<&y6> x; | ||
}; | ||
#else | ||
S6 s6; | ||
// [email protected]:* {{'TemplateArgument::S6::x' from module 'FirstModule' is not present in definition of 'TemplateArgument::S6' in module 'SecondModule'}} | ||
// [email protected]:* {{declaration of 'x' does not match}} | ||
#endif | ||
} | ||
|
||
// Interesting cases that should not cause errors. struct S should not error | ||
// while struct T should error at the access specifier mismatch at the end. | ||
namespace AllDecls { | ||
|