]> granicus.if.org Git - clang/commitdiff
[AST] AttributedType should derive type properties from the EquivalentType
authorDavid Majnemer <david.majnemer@gmail.com>
Tue, 17 Jan 2017 04:14:25 +0000 (04:14 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Tue, 17 Jan 2017 04:14:25 +0000 (04:14 +0000)
Using the canonical type instead of the equivalent type can result in
insufficient template instantiations.

This fixes PR31656.

Differential Revision: https://reviews.llvm.org/D28788

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292194 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Type.h
test/CodeGenCXX/microsoft-abi-default-cc.cpp

index c8b488e916ca5f364b8b2e8b52e5c39ad09c70d0..f0147c42e27bfc1866685d35e56c6c8cc1c88910 100644 (file)
@@ -3832,13 +3832,13 @@ private:
 
   friend class ASTContext; // creates these
 
-  AttributedType(QualType canon, Kind attrKind,
-                 QualType modified, QualType equivalent)
-    : Type(Attributed, canon, canon->isDependentType(),
-           canon->isInstantiationDependentType(),
-           canon->isVariablyModifiedType(),
-           canon->containsUnexpandedParameterPack()),
-      ModifiedType(modified), EquivalentType(equivalent) {
+  AttributedType(QualType canon, Kind attrKind, QualType modified,
+                 QualType equivalent)
+      : Type(Attributed, canon, equivalent->isDependentType(),
+             equivalent->isInstantiationDependentType(),
+             equivalent->isVariablyModifiedType(),
+             equivalent->containsUnexpandedParameterPack()),
+        ModifiedType(modified), EquivalentType(equivalent) {
     AttributedTypeBits.AttrKind = attrKind;
   }
 
index e3ca39221e88da4d34f2e2c599a02692bd065285..6259a53dbf39d3950244c65ee46ccf8b000e3e2e 100644 (file)
@@ -45,3 +45,12 @@ void __cdecl static_baz() {}
 void static_qux() {}
 // GCABI-LABEL: define void @_Z10static_quxv
 // MSABI: define void @"\01?static_qux@@YAXXZ"
+
+namespace PR31656 {
+template <int I>
+void __cdecl callee(int args[I]);
+// GCABI-LABEL: declare void @_ZN7PR316566calleeILi1EEEvPi(
+// MSABI: declare void @"\01??$callee@$00@PR31656@@YAXQAH@Z"(
+
+void caller() { callee<1>(0); }
+}