Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suppress printing template arguments that match default template
arguments of types by default. This somewhat improves the worst-case printing of types like std::string, std::vector, etc., where many irrelevant default arguments can be included in the type as printed if we've lost the type sugar.
- Loading branch information
Showing
11 changed files
with
247 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// RUN: %clang_cc1 -verify %s | ||
|
||
namespace default_args { | ||
template<typename T> struct char_traits; | ||
template<typename T> struct allocator; | ||
template<typename T, typename = char_traits<T>, typename = allocator<T>> struct basic_string {}; | ||
|
||
typedef basic_string<char> string; | ||
|
||
template<typename T> T f(T); | ||
|
||
void test1() { | ||
string s; | ||
f(s).size(); // expected-error {{no member named 'size' in 'default_args::basic_string<char>'}} | ||
} | ||
|
||
template<typename T> struct default_delete {}; | ||
template<class T, class Deleter = default_delete<T>> class unique_ptr {}; | ||
template<class T, class Deleter> class unique_ptr<T[], Deleter> {}; | ||
void test2() { | ||
unique_ptr<string> ups; | ||
f(ups).reset(); // expected-error {{no member named 'reset' in 'default_args::unique_ptr<default_args::basic_string<char>>'}} | ||
} | ||
|
||
template<int A, int B = A> struct Z { int error[B]; }; // expected-error {{negative size}} | ||
Z<-1> z; // expected-note {{in instantiation of template class 'default_args::Z<-1>' requested here}} | ||
|
||
template<template<typename> class A = allocator, template<typename> class B = A> struct Q {}; | ||
void test3() { | ||
f(Q<>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}} | ||
f(Q<allocator>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}} | ||
f(Q<allocator, allocator>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}} | ||
f(Q<char_traits>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<char_traits>'}} | ||
f(Q<char_traits, char_traits>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<char_traits>'}} | ||
f(Q<char_traits, allocator>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<char_traits, allocator>'}} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.