From 20a09a659ed43b4400e6ec0fb9a187d61bec6803 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 10 Feb 2014 19:53:17 +0000 Subject: [PATCH] Tests for DR351-370, plus update DR status page to match the latest core issue list. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201106 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CXX/drs/dr3xx.cpp | 264 ++++++++++++++++++++++++ www/cxx_dr_status.html | 450 +++++++++++++++++++++++++++++++---------- 2 files changed, 612 insertions(+), 102 deletions(-) diff --git a/test/CXX/drs/dr3xx.cpp b/test/CXX/drs/dr3xx.cpp index 2791c1f311..35fd8a4d37 100644 --- a/test/CXX/drs/dr3xx.cpp +++ b/test/CXX/drs/dr3xx.cpp @@ -527,3 +527,267 @@ namespace dr349 { // dr349: no B b; const int *const *const *p2 = b; } + +// dr351: na + +namespace dr352 { // dr352: yes + namespace example1 { + namespace A { + enum E {}; + template void foo(E, R (*)(A)); // expected-note 2{{couldn't infer template argument 'R'}} + } + + template void arg(T); + template int arg(T) = delete; // expected-note {{here}} expected-error 0-1{{extension}} + + void f(A::E e) { + foo(e, &arg); // expected-error {{no matching function}} + + using A::foo; + foo(e, &arg); // expected-error {{deleted}} + } + + int arg(int); + + void g(A::E e) { + foo(e, &arg); // expected-error {{no matching function}} + + using A::foo; + foo(e, &arg); // ok, uses non-template + } + } + + namespace contexts { + template void f1(int (&)[I]); + template void f2(int (&)[I+1]); // expected-note {{couldn't infer}} + template void f3(int (&)[I+1], int (&)[I]); + void f() { + int a[4]; + int b[3]; + f1(a); + f2(a); // expected-error {{no matching function}} + f3(a, b); + } + + template struct S {}; + template void g1(S); + template void g2(S); // expected-note {{couldn't infer}} + template void g3(S, S); + void g() { + S<4> a; + S<3> b; + g1(a); + g2(a); // expected-error {{no matching function}} + g3(a, b); + } + + template void h1(T = 0); // expected-note {{couldn't infer}} + template void h2(T, T = 0); + void h() { + h1(); // expected-error {{no matching function}} + h1(0); + h1(); + h2(0); + } + + template int tmpl(T); + template void i1(R (*)(A)); // expected-note 3{{couldn't infer}} + template void i2(R, A, R (*)(A)); // expected-note {{not viable}} + void i() { + extern int single(int); + i1(single); + i2(0, 0, single); + + extern int ambig(float), ambig(int); + i1(ambig); // expected-error {{no matching function}} + i2(0, 0, ambig); + + extern void no_match(float), no_match(int); + i1(no_match); // expected-error {{no matching function}} + i2(0, 0, no_match); // expected-error {{no matching function}} + + i1(tmpl); // expected-error {{no matching function}} + i2(0, 0, tmpl); + } + } + + template struct is_int; + template<> struct is_int {}; + + namespace example2 { + template int f(T (*p)(T)) { is_int(); } + int g(int); + int g(char); + int i = f(g); + } + + namespace example3 { + template int f(T, T (*p)(T)) { is_int(); } + int g(int); + char g(char); + int i = f(1, g); + } + + namespace example4 { + template int f(T, T (*p)(T)) { is_int(); } + char g(char); + template T g(T); + int i = f(1, g); + } + + namespace example5 { + template class A {}; + template void g(A); // expected-note {{couldn't infer}} + template void f(A, A); + void h(A<1> a1, A<2> a2) { + g(a1); // expected-error {{no matching function}} + g<0>(a1); + f(a1, a2); + } + } +} + +// dr353 needs an IRGen test. + +namespace dr354 { // dr354: yes c++11 + // FIXME: Should we allow this in C++98 too? + struct S {}; + + template struct ptr {}; // expected-note +{{here}} + ptr<0> p0; + ptr<(int*)0> p1; + ptr<(float*)0> p2; + ptr<(int S::*)0> p3; +#if __cplusplus < 201103L + // expected-error@-5 {{does not refer to any decl}} + // expected-error@-5 {{does not refer to any decl}} + // expected-error@-5 {{does not refer to any decl}} + // expected-error@-5 {{does not refer to any decl}} +#else + // expected-error@-10 {{must be cast}} + // ok + // expected-error@-10 {{does not match}} + // expected-error@-10 {{does not match}} +#endif + + template int both(); + template int both(); + int b0 = both<0>(); + int b1 = both<(int*)0>(); +#if __cplusplus < 201103L + // expected-error@-2 {{no matching function}} + // expected-note@-6 {{candidate}} + // expected-note@-6 {{candidate}} +#endif + + template struct ptr_mem {}; // expected-note +{{here}} + ptr_mem<0> m0; + ptr_mem<(int S::*)0> m1; + ptr_mem<(float S::*)0> m2; + ptr_mem<(int *)0> m3; +#if __cplusplus < 201103L + // expected-error@-5 {{cannot be converted}} + // expected-error@-5 {{is not a pointer to member constant}} + // expected-error@-5 {{cannot be converted}} + // expected-error@-5 {{cannot be converted}} +#else + // expected-error@-10 {{must be cast}} + // ok + // expected-error@-10 {{does not match}} + // expected-error@-10 {{does not match}} +#endif +} + +struct dr355_S; // dr355: yes +struct ::dr355_S {}; // expected-warning {{extra qualification}} +namespace dr355 { struct ::dr355_S s; } + +// dr356: na + +namespace dr357 { // dr357: yes + template struct A { + void f() const; // expected-note {{const qualified}} + }; + template void A::f() {} // expected-error {{does not match}} + + struct B { + template void f(); + }; + template void B::f() const {} // expected-error {{does not match}} +} + +namespace dr358 { // dr358: yes + extern "C" void dr358_f(); + namespace N { + int var; + extern "C" void dr358_f() { var = 10; } + } +} + +namespace dr359 { // dr359: yes + // Note, the example in the DR is wrong; it doesn't contain an anonymous + // union. + struct E { + union { + struct { + int x; + } s; + } v; + + union { + struct { // expected-error {{extension}} + int x; + } s; + + struct S { // expected-error {{types cannot be declared in an anonymous union}} + int x; + } t; + + union { // expected-error {{extension}} + int u; + }; + }; + }; +} + +// dr362: na +// dr363: na + +namespace dr364 { // dr364: yes + struct S { + static void f(int); + void f(char); + }; + + void g() { + S::f('a'); // expected-error {{call to non-static}} + S::f(0); + } +} + +#if "foo" // expected-error {{invalid token}} dr366: yes +#endif + +namespace dr367 { // dr367: yes + // FIXME: These diagnostics are terrible. Don't diagnose an ill-formed global + // array as being a VLA! + int a[true ? throw 0 : 4]; // expected-error 2{{variable length array}} + int b[true ? 4 : throw 0]; + int c[true ? *new int : 4]; // expected-error 2{{variable length array}} + int d[true ? 4 : *new int]; +#if __cplusplus < 201103L + // expected-error@-4 {{variable length array}} expected-error@-4 {{constant expression}} + // expected-error@-3 {{variable length array}} expected-error@-3 {{constant expression}} +#endif +} + +namespace dr368 { // dr368: yes + template struct S {}; // expected-note {{here}} + template int f(S *); // expected-error {{function type}} + //template int g(S *); // FIXME: crashes clang + template int g(S *); // expected-note {{cannot have type 'dr368::X'}} + struct X {}; + int n = g(0); // expected-error {{no matching}} +} + +// dr370: na diff --git a/www/cxx_dr_status.html b/www/cxx_dr_status.html index ace581cdf9..918376c8e1 100644 --- a/www/cxx_dr_status.html +++ b/www/cxx_dr_status.html @@ -524,7 +524,7 @@ 81 NAD - Null pointers and C compatability + Null pointers and C compatibility N/A @@ -2147,13 +2147,13 @@ of class templates 351 CD1 Sequence point error: unspecified or undefined? - Unknown + N/A 352 CD1 Nondeduced contexts - Unknown + Yes 353 @@ -2165,37 +2165,37 @@ of class templates 354 CD1 Null as nontype template argument - Unknown + Yes (C++11 onwards) 355 FDIS Global-scope :: in nested-name-specifier - Unknown + Yes 356 NAD Wording of behavior of generated copy constructor for scalar members - Unknown + N/A 357 CD1 Definition of signature should include name - Unknown + Yes 358 NAD Namespaces and extern "C" - Unknown + Yes 359 NAD Type definition in anonymous union - Unknown + Yes 360 @@ -2213,19 +2213,19 @@ of class templates 362 CD1 Order of initialization in instantiation units - Unknown + N/A 363 NAD Initialization of class from self - Unknown + N/A 364 CD1 Calling overloaded function with static in set, with no object - Unknown + Yes 365 @@ -2237,19 +2237,19 @@ of class templates 366 CD1 String literal allowed in integral constant expression? - Unknown + Yes 367 CD1 throw operator allowed in constant expression? - Unknown + Yes 368 CD1 Uses of non-type parameters that should cause deduction to fail - Unknown + Yes 369 @@ -2261,7 +2261,7 @@ of class templates 370 CD1 Can #include <...> form be used other than for standard C++ headers? - Unknown + N/A 371 @@ -8160,7 +8160,7 @@ and POD class 1391 drafting - Conversions to parameter types with non deduced template arguments + Conversions to parameter types with non-deduced template arguments Not resolved @@ -8626,8 +8626,8 @@ and POD class Not resolved - 1469 - drafting + 1469 + extension Omitted bound in array new-expression Not resolved @@ -8691,11 +8691,11 @@ and POD class Literal operators and default arguments Unknown - - 1480 - drafting + + 1480 + WP Constant initialization via non-constant temporary - Not resolved + Unknown 1481 @@ -9304,8 +9304,8 @@ and POD class Not resolved - 1582 - drafting + 1582 + extension Template default arguments and deduction failure Not resolved @@ -9328,8 +9328,8 @@ and POD class Unknown - 1586 - drafting + 1586 + extension Naming a destructor via decltype Not resolved @@ -9399,11 +9399,11 @@ and POD class Misleading constexpr example Unknown - + 1598 - drafting + tentatively ready Criterion for equality of pointers to members - Not resolved + Unknown 1599 @@ -9585,11 +9585,11 @@ and POD class Deallocation function templates Not resolved - + 1629 - drafting + tentatively ready Can a closure class be a literal type? - Not resolved + Unknown 1630 @@ -9711,11 +9711,11 @@ and POD class Error in the syntax of mem-initializer-list Unknown - - 1650 - open + + 1650 + NAD Class prvalues in reference initialization - Not resolved + Unknown 1651 @@ -9759,11 +9759,11 @@ and POD class Attributes for namespaces and enumerators Not resolved - + 1658 - drafting + tentatively ready Deleted default constructor for abstract class via destructor - Not resolved + Unknown 1659 @@ -9771,11 +9771,11 @@ and POD class Initialization order of thread_local template static data members Not resolved - + 1660 - open + tentatively ready member-declaration requirements and unnamed bit-fields - Not resolved + Unknown 1661 @@ -9807,11 +9807,11 @@ and POD class Declaration matching in explicit instantiations Not resolved - + 1666 - drafting + tentatively ready Address constant expressions - Not resolved + Unknown 1667 @@ -9825,11 +9825,11 @@ and POD class Parameter type determination still not clear enough Not resolved - + 1669 - drafting + tentatively ready auto return type for main - Not resolved + Unknown 1670 @@ -9855,11 +9855,11 @@ and POD class Clarifying overload resolution for the second step of copy-initialization Not resolved - + 1674 - drafting + tentatively ready Return type deduction for address of function - Not resolved + Unknown 1675 @@ -9915,11 +9915,11 @@ and POD class Incorrect example after constexpr changes Not resolved - + 1684 - drafting + tentatively ready Static constexpr member functions for non-literal classes - Not resolved + Unknown 1685 @@ -9933,11 +9933,11 @@ and POD class Which variables are “explicitly declared const?” Not resolved - + 1687 - drafting + tentatively ready Conversions of operands of built-in operators - Not resolved + Unknown 1688 @@ -9945,11 +9945,11 @@ and POD class Volatile constexpr variables Unknown - + 1689 - drafting + tentatively ready Syntactic nonterminal for operand of alignas - Not resolved + Unknown 1690 @@ -9969,11 +9969,11 @@ and POD class Associated namespaces of doubly-nested classes Unknown - + 1693 - drafting + tentatively ready Superfluous semicolons in class definitions - Not resolved + Unknown 1694 @@ -10053,11 +10053,11 @@ and POD class alignas pack expansion syntax Not resolved - + 1707 - drafting + tentatively ready template in elaborated-type-specifier without nested-name-specifier - Not resolved + Unknown 1708 @@ -10095,11 +10095,11 @@ and POD class Linkage of variable template specializations Not resolved - - 1714 - drafting + + 1714 + NAD odr-use of this from a local class - Not resolved + Unknown 1715 @@ -10107,11 +10107,11 @@ and POD class Access and inherited constructor templates Not resolved - + 1716 - drafting + tentatively ready When are default arguments evaluated? - Not resolved + Unknown 1717 @@ -10203,11 +10203,11 @@ and POD class is_trivially_X and definitions of special member functions Unknown - + 1732 - drafting + tentatively ready Defining types in conditions and range-based for statements - Not resolved + Unknown 1733 @@ -10233,23 +10233,23 @@ and POD class Inheriting constructor templates in a local class Not resolved - + 1737 - drafting + tentatively ready Type dependence of call to a member of the current instantiation - Not resolved + Unknown - + 1738 - drafting + tentatively ready Explicit instantiation/specialization of inheriting constructor templates - Not resolved + Unknown - + 1739 - drafting + tentatively ready Conversion of floating point to enumeration - Not resolved + Unknown 1740 @@ -10281,23 +10281,23 @@ and POD class Unordered initialization for variable template specializations Not resolved - - 1745 - open + + 1745 + NAD thread_local constexpr variable - Not resolved + Unknown - + 1746 - open + tentatively ready Are volatile scalar types trivially copyable? - Not resolved + Unknown - + 1747 - open + tentatively ready Constant initialization of reference to function - Not resolved + Unknown 1748 @@ -10425,11 +10425,11 @@ and POD class Zero-element array of runtime bound Unknown - + 1769 - review + tentatively ready Catching a base class of the exception object - Not resolved + Unknown 1770 @@ -10479,11 +10479,11 @@ and POD class Empty pack expansion in dynamic-exception-specification Not resolved - + 1778 - ready + review exception-specification in explicitly-defaulted functions - Unknown + Not resolved 1779 @@ -10587,6 +10587,252 @@ and POD class Disambiguating original-namespace-definition and extension-namespace-definition Not resolved + + 1796 + open + Is all-bits-zero for null characters a meaningful requirement? + Not resolved + + + 1797 + open + Are all bit patterns of unsigned char distinct numbers? + Not resolved + + + 1798 + open + exception-specifications of template arguments + Not resolved + + + 1799 + review + mutable and non-explicit const qualification + Not resolved + + + 1800 + open + Pointer to member of nested anonymous union + Not resolved + + + 1801 + open + Kind of expression referring to member of anonymous union + Not resolved + + + 1802 + open + char16_t string literals and surrogate pairs + Not resolved + + + 1803 + open + opaque-enum-declaration as member-declaration + Not resolved + + + 1804 + open + Partial specialization and friendship + Not resolved + + + 1805 + open + Conversions of array operands in conditional-expressions + Not resolved + + + 1806 + open + Virtual bases and move-assignment + Not resolved + + + 1807 + open + Order of destruction of array elements after an exception + Not resolved + + + 1808 + open + Constructor templates vs default constructors + Not resolved + + + 1809 + open + Narrowing and template argument deduction + Not resolved + + + 1810 + open + Invalid ud-suffixes + Not resolved + + + 1811 + open + Lookup of deallocation function in a virtual destructor definition + Not resolved + + + 1812 + open + Omission of template in a typename-specifier + Not resolved + + + 1813 + open + Direct vs indirect bases in standard-layout classes + Not resolved + + + 1814 + open + Default arguments in lambda-expressions + Not resolved + + + 1815 + open + Lifetime extension in aggregate initialization + Not resolved + + + 1816 + open + Unclear specification of bit-field values + Not resolved + + + 1817 + open + Linkage specifications and nested scopes + Not resolved + + + 1818 + open + Visibility and inherited language linkage + Not resolved + + + 1819 + open + Acceptable scopes for definition of partial specialization + Not resolved + + + 1820 + open + Qualified typedef names + Not resolved + + + 1821 + open + Qualified redeclarations in a class member-specification + Not resolved + + + 1822 + open + Lookup of parameter names in lambda-expressions + Not resolved + + + 1823 + open + String literal uniqueness in inline functions + Not resolved + + + 1824 + open + Completeness of return type vs point of instantiation + Not resolved + + + 1825 + open + Partial ordering between variadic and non-variadic function templates + Not resolved + + + 1826 + open + const floating-point in constant expressions + Not resolved + + + 1827 + open + Reference binding with ambiguous conversions + Not resolved + + + 1828 + open + nested-name-specifier ambiguity + Not resolved + + + 1829 + open + Dependent unnamed types + Not resolved + + + 1830 + open + Repeated specifiers + Not resolved + + + 1831 + open + Explicitly vs implicitly deleted move constructors + Not resolved + + + 1832 + open + Casting to incomplete enumeration + Not resolved + + + 1833 + open + friend declarations naming implicitly-declared member functions + Not resolved + + + 1834 + open + Constant initialization binding a reference to an xvalue + Not resolved + + + 1835 + open + Dependent member lookup before < + Not resolved + + + 1836 + open + Use of class type being defined in trailing-return-type + Not resolved + -- 2.40.0