summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/mangle-template.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2013-12-04 09:01:55 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2013-12-04 09:01:55 +0000
commitdbc0c8f9414fe854f2eecf547c43b34c76b9c21b (patch)
treecb1fbf05e07aff7c2fe6791edfb3fd4b4da05f03 /clang/test/CodeGenCXX/mangle-template.cpp
parent87a24d5c2716a0ace9a3321914cdf682accec15a (diff)
downloadbcm5719-llvm-dbc0c8f9414fe854f2eecf547c43b34c76b9c21b.tar.gz
bcm5719-llvm-dbc0c8f9414fe854f2eecf547c43b34c76b9c21b.zip
Sema: Propagate the mangling number into instantiations
We would lose track of the mangling number assigned to the original declaration which would cause us to create manglings that didn't match the Itanium C++ specification. e.g. Two static fields with the same name inside of a function template would receive the same mangling with LLVM fixing up the second field so they wouldn't collide. This would create an incompatibility with other compilers following the Itanium ABI. I've confirmed that the new mangling is identical to the ones generated by icc and gcc. N.B. This was uncovered while working on Microsoft mangler. llvm-svn: 196368
Diffstat (limited to 'clang/test/CodeGenCXX/mangle-template.cpp')
-rw-r--r--clang/test/CodeGenCXX/mangle-template.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/mangle-template.cpp b/clang/test/CodeGenCXX/mangle-template.cpp
index 3b7f3027f6c..9bd74b54a5b 100644
--- a/clang/test/CodeGenCXX/mangle-template.cpp
+++ b/clang/test/CodeGenCXX/mangle-template.cpp
@@ -182,3 +182,25 @@ namespace test13 {
template short returnShort<-32768>();
// CHECK: @_ZN6test1311returnShortILsn32768EEEsv()
}
+
+namespace test14 {
+ template <typename> inline int inl(bool b) {
+ if (b) {
+ static struct {
+ int field;
+ } a;
+ // CHECK: @_ZZN6test143inlIvEEibE1a
+
+ return a.field;
+ } else {
+ static struct {
+ int field;
+ } a;
+ // CHECK: @_ZZN6test143inlIvEEibE1a_0
+
+ return a.field;
+ }
+ }
+
+ int call(bool b) { return inl<void>(b); }
+}
OpenPOWER on IntegriCloud