1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // Note: the formatting in this test case is intentionally funny, with
4 // nested-name-specifiers stretched out vertically so that we can
5 // match up diagnostics per-line and still verify that we're getting
6 // good source-location information.
17 struct add_reference
{
21 namespace outer_alias
= outer
;
24 struct UnresolvedUsingValueDeclTester
{
25 using outer::inner::X0
<
26 typename add_reference
<T
>::type
27 * // expected-error{{declared as a pointer to a reference of type}}
31 UnresolvedUsingValueDeclTester
<int> UnresolvedUsingValueDeclCheck
; // expected-note{{in instantiation of template class}}
34 struct UnresolvedUsingTypenameDeclTester
{
35 using outer::inner::X0
<
36 typename add_reference
<T
>::type
37 * // expected-error{{declared as a pointer to a reference of type}}
41 UnresolvedUsingTypenameDeclTester
<int> UnresolvedUsingTypenameDeclCheck
; // expected-note{{in instantiation of template class}}
44 template<typename T
, typename U
>
45 struct PseudoDestructorExprTester
{
47 t
->T::template Inner
<typename add_reference
<U
>::type
48 * // expected-error{{as a pointer to a reference of type}}
53 struct HasInnerTemplate
{
57 typedef HasInnerTemplate T
;
60 void PseudoDestructorExprCheck(
61 PseudoDestructorExprTester
<HasInnerTemplate
, float> tester
) {
62 tester
.f(0); // expected-note{{in instantiation of member function}}
66 struct DependentScopedDeclRefExpr
{
68 outer_alias::inner::X0
<typename add_reference
<T
>::type
69 * // expected-error{{as a pointer to a reference of type}}
74 void DependentScopedDeclRefExprCheck(DependentScopedDeclRefExpr
<int> t
) {
75 t
.f(); // expected-note{{in instantiation of member function}}
80 struct TypenameTypeTester
{
81 typedef typename
outer::inner::X0
<
82 typename add_reference
<T
>::type
83 * // expected-error{{declared as a pointer to a reference of type}}
87 TypenameTypeTester
<int> TypenameTypeCheck
; // expected-note{{in instantiation of template class}}
89 template<typename T
, typename U
>
90 struct DependentTemplateSpecializationTypeTester
{
91 typedef typename
T::template apply
<typename add_reference
<U
>::type
92 * // expected-error{{declared as a pointer to a reference of type}}
103 DependentTemplateSpecializationTypeTester
<HasApply
, int> DTSTCheck
; // expected-note{{in instantiation of template class}}
105 template<typename T
, typename U
>
106 struct DependentTemplateSpecializationTypeTester2
{
107 typedef typename
T::template apply
<typename add_reference
<U
>::type
108 * // expected-error{{declared as a pointer to a reference of type}}
112 DependentTemplateSpecializationTypeTester2
<HasApply
, int> DTSTCheck2
; // expected-note{{in instantiation of template class}}
114 template<typename T
, typename U
>
115 struct DependentTemplateSpecializationTypeTester3
:
116 T::template apply
<typename add_reference
<U
>::type
117 * // expected-error{{declared as a pointer to a reference of type}}
121 DependentTemplateSpecializationTypeTester3
<HasApply
, int> DTSTCheck3
; // expected-note{{in instantiation of template class}}
123 template<typename T
, typename U
>
124 struct DependentTemplateSpecializationTypeTester4
{
125 typedef class T::template apply
<typename add_reference
<U
>::type
126 * // expected-error{{declared as a pointer to a reference of type}}
130 DependentTemplateSpecializationTypeTester4
<HasApply
, int> DTSTCheck4
; // expected-note{{in instantiation of template class}}
132 template<template<class T
> class TTP
>
133 struct AcceptedTemplateTemplateParameter
{
136 template<typename T
, typename U
>
137 struct DependentTemplateTemplateArgumentTester
{
138 typedef AcceptedTemplateTemplateParameter
<
141 typename add_reference
<U
>::type
142 * // expected-error{{declared as a pointer to a reference of type}}
148 DependentTemplateTemplateArgumentTester
<HasApply
, int> DTTACheck
; // expected-note{{in instantiation of template class}}
152 template<typename T
> class vector
{
155 template<typename T
> static void foo(std::vector
<T
*> &V
) {
156 __PRETTY_FUNCTION__
; // expected-warning{{expression result unused}}
158 void bar(std::vector
<int*> &Blocks
) {
159 foo(Blocks
); // expected-note{{in instantiation of}}