Richard Smith | 9ca5c42 | 2011-10-13 22:29:44 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify |
Douglas Gregor | 5223529 | 2011-09-22 23:04:35 | [diff] [blame] | 2 | |
| 3 | namespace PR10457 { |
| 4 | |
| 5 | class string |
| 6 | { |
| 7 | string(const char* str, unsigned); |
| 8 | |
| 9 | public: |
| 10 | template <unsigned N> |
| 11 | string(const char (&str)[N]) |
| 12 | : string(str) {} // expected-error{{constructor for 'string<6>' creates a delegation cycle}} |
| 13 | }; |
| 14 | |
| 15 | void f() { |
| 16 | string s("hello"); |
| 17 | } |
Douglas Gregor | d73f3dd | 2011-11-01 01:16:03 | [diff] [blame] | 18 | |
| 19 | struct Foo { |
| 20 | Foo(int) { } |
| 21 | |
| 22 | |
| 23 | template <typename T> |
| 24 | Foo(T, int i) : Foo(i) { } |
| 25 | }; |
| 26 | |
| 27 | void test_Foo() |
| 28 | { |
| 29 | Foo f(1, 1); |
| 30 | } |
Douglas Gregor | 5223529 | 2011-09-22 23:04:35 | [diff] [blame] | 31 | } |
Eli Friedman | a9e9ebc | 2012-05-19 23:35:23 | [diff] [blame] | 32 | |
| 33 | namespace PR12890 { |
| 34 | class Document |
| 35 | { |
| 36 | public: |
| 37 | Document() = default; |
| 38 | |
| 39 | template <class T> |
| 40 | explicit |
| 41 | Document(T&& t) : Document() |
| 42 | { |
| 43 | } |
| 44 | }; |
| 45 | void f() |
| 46 | { |
| 47 | Document d(1); |
| 48 | } |
| 49 | } |