/// template argument.
InternalIterator(const TemplateSpecializationType *TST)
: TST(TST), Index(0), CurrentTA(nullptr), EndTA(nullptr) {
+ if (!TST) return;
+
if (isEnd()) return;
// Set to first template argument. If not a parameter pack, done.
/// isEnd - Returns true if the iterator is one past the end.
bool isEnd() const {
+ assert(TST && "InternalalIterator is invalid with a null TST.");
return Index >= TST->getNumArgs();
}
/// &operator++ - Increment the iterator to the next template argument.
InternalIterator &operator++() {
+ assert(TST && "InternalalIterator is invalid with a null TST.");
if (isEnd()) {
return *this;
}
/// operator* - Returns the appropriate TemplateArgument.
reference operator*() const {
+ assert(TST && "InternalalIterator is invalid with a null TST.");
assert(!isEnd() && "Index exceeds number of arguments.");
if (CurrentTA == EndTA)
return TST->getArg(Index);
/// operator-> - Allow access to the underlying TemplateArgument.
pointer operator->() const {
+ assert(TST && "InternalalIterator is invalid with a null TST.");
return &operator*();
}
};
}
// CHECK-ELIDE-NOTREE: error: no matching function for call to 'D'
// CHECK-ELIDE-NOTREE: note: candidate function [with x = TypeAlias::X::X1] not viable: no known conversion from 'VectorType<X::X2>' to 'const VectorType<(TypeAlias::X)0>' for 1st argument
+}
+
+namespace TypeAlias2 {
+template <typename T>
+class A {};
+
+template <typename T>
+using A_reg = A<T>;
+void take_reg(A_reg<int>);
+
+template <typename T>
+using A_ptr = A<T> *;
+void take_ptr(A_ptr<int>);
+
+template <typename T>
+using A_ref = const A<T> &;
+void take_ref(A_ref<int>);
+void run(A_reg<float> reg, A_ptr<float> ptr, A_ref<float> ref) {
+ take_reg(reg);
+// CHECK-ELIDE-NOTREE: error: no matching function for call to 'take_reg'
+// CHECK-ELIDE-NOTREE: note: candidate function not viable: no known conversion from 'A_reg<float>' to 'A_reg<int>' for 1st argument
+
+ take_ptr(ptr);
+// CHECK-ELIDE-NOTREE: error: no matching function for call to 'take_ptr'
+// CHECK-ELIDE-NOTREE: note: candidate function not viable: no known conversion from 'A_ptr<float>' to 'A_ptr<int>' for 1st argument
+
+ take_ref(ref);
+// CHECK-ELIDE-NOTREE: error: no matching function for call to 'take_ref'
+// CHECK-ELIDE-NOTREE: note: candidate function not viable: no known conversion from 'const A<float>' to 'const A<int>' for 1st argument
+}
}
// CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.