1 // RUN: %clang_cc1 -verify %s
3 namespace default_args
{
4 template<typename T
> struct char_traits
;
5 template<typename T
> struct allocator
;
6 template<typename T
, typename
= char_traits
<T
>, typename
= allocator
<T
>> struct basic_string
{};
8 typedef basic_string
<char> string
;
10 template<typename T
> T
f(T
);
14 f(s
).size(); // expected-error {{no member named 'size' in 'default_args::basic_string<char>'}}
17 template<typename T
> struct default_delete
{};
18 template<class T
, class Deleter
= default_delete
<T
>> class unique_ptr
{
20 void f() { T::error(); } // expected-error {{no member named 'error' in 'default_args::basic_string<char>'}}
22 template<class T
, class Deleter
> class unique_ptr
<T
[], Deleter
> {};
24 unique_ptr
<string
> ups
;
25 f(ups
).reset(); // expected-error {{no member named 'reset' in 'default_args::unique_ptr<default_args::basic_string<char>>'}}
26 f(ups
).f(); // expected-note {{in instantiation of member function 'default_args::unique_ptr<default_args::basic_string<char>>::f' requested here}}
29 template<int A
, int B
= A
, int C
= 42> struct Z
{ int error
[B
]; }; // expected-error {{negative size}}
30 Z
<-1> z
; // expected-note {{in instantiation of template class 'default_args::Z<-1>' requested here}}
32 template<template<typename
> class A
= allocator
, template<typename
> class B
= A
> struct Q
{};
34 f(Q
<>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}}
35 f(Q
<allocator
>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}}
36 f(Q
<allocator
, allocator
>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}}
37 f(Q
<char_traits
>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<default_args::char_traits>'}}
38 f(Q
<char_traits
, char_traits
>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<default_args::char_traits>'}}
39 f(Q
<char_traits
, allocator
>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<default_args::char_traits, default_args::allocator>'}}