diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 |
commit | 7442d6faa2719e4e7d33a7021c406c5a4facd74d (patch) | |
tree | c72b9241553fc9966179aba84f90f17bfa9235c3 /test/SemaCXX/cxx0x-initializer-references.cpp | |
parent | b52119637f743680a99710ce5fdb6646da2772af (diff) |
Diffstat (limited to 'test/SemaCXX/cxx0x-initializer-references.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-initializer-references.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/SemaCXX/cxx0x-initializer-references.cpp b/test/SemaCXX/cxx0x-initializer-references.cpp index c64511193b6e7..ce029d7f07321 100644 --- a/test/SemaCXX/cxx0x-initializer-references.cpp +++ b/test/SemaCXX/cxx0x-initializer-references.cpp @@ -71,10 +71,22 @@ namespace reference { static_assert(sizeof(h({1, 2})) == sizeof(two), "bad overload resolution"); } + struct X {}; + void edge_cases() { - int const &b({0}); // expected-error {{list-initializer for non-class type 'const int &' must not be parenthesized}} - const int (&arr)[3] ({1, 2, 3}); // expected-error {{list-initializer for non-class type 'const int (&)[3]' must not be parenthesized}} + int const &b({0}); // expected-error {{cannot initialize reference type 'const int &' with a parenthesized initializer list}} + const int (&arr)[3] ({1, 2, 3}); // expected-error {{cannot initialize reference type 'const int (&)[3]' with a parenthesized initializer list}} + const X &x({}); // expected-error {{cannot initialize reference type 'const reference::X &' with a parenthesized initializer list}} + } + + template<typename T> void dependent_edge_cases() { + T b({}); // expected-error-re 3{{cannot initialize reference type {{.*}} with a parenthesized init}} + T({}); // expected-error-re 3{{cannot initialize reference type {{.*}} with a parenthesized init}} } + template void dependent_edge_cases<X>(); // ok + template void dependent_edge_cases<const int&>(); // expected-note {{instantiation of}} + template void dependent_edge_cases<const int(&)[1]>(); // expected-note {{instantiation of}} + template void dependent_edge_cases<const X&>(); // expected-note {{instantiation of}} } namespace PR12182 { |