From: Vlad Serebrennikov Date: Wed, 31 May 2023 07:16:51 +0000 (+0300) Subject: [clang] Add test for CWG873 X-Git-Tag: upstream/17.0.6~6696 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=238f15820e71080b0bbc7d6ee95303fdb430d6fa;p=platform%2Fupstream%2Fllvm.git [clang] Add test for CWG873 Also add missing marking to the test of related issue 621. https://cplusplus.github.io/CWG/issues/621.html https://cplusplus.github.io/CWG/issues/873.html Reviewed By: #clang-language-wg, shafik Differential Revision: https://reviews.llvm.org/D151704 --- diff --git a/clang/test/CXX/drs/dr6xx.cpp b/clang/test/CXX/drs/dr6xx.cpp index 59331e7..a08f55d 100644 --- a/clang/test/CXX/drs/dr6xx.cpp +++ b/clang/test/CXX/drs/dr6xx.cpp @@ -234,7 +234,7 @@ namespace dr619 { // dr619: yes // dr620: dup 568 -namespace dr621 { +namespace dr621 { // dr621: yes template T f(); template<> int f() {} // expected-note {{previous}} template<> int f() {} // expected-error {{redefinition}} diff --git a/clang/test/CXX/drs/dr8xx.cpp b/clang/test/CXX/drs/dr8xx.cpp new file mode 100644 index 0000000..d79430f --- /dev/null +++ b/clang/test/CXX/drs/dr8xx.cpp @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s +// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s +// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s +// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s + +// expected-no-diagnostics + +namespace dr873 { // dr873: yes +#if __cplusplus >= 201103L +template void f(T &&); +template <> void f(int &) {} // #1 +template <> void f(int &&) {} // #2 +void g(int i) { + f(i); // calls f(int&), i.e., #1 +#pragma clang __debug dump f(i) + // CHECK: CallExpr {{.*}} + // CHECK-NEXT: |-ImplicitCastExpr {{.*}} + // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'f' 'void (int &)' {{.*}} + + f(0); // calls f(int&&), i.e., #2 +#pragma clang __debug dump f(0) + // CHECK: CallExpr {{.*}} + // CHECK-NEXT: |-ImplicitCastExpr {{.*}} + // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'f' 'void (int &&)' {{.*}} +} +#endif +} // namespace dr873 diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index ec2ac24..77790bc 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -3767,7 +3767,7 @@ and POD class 621 C++11 Template argument deduction from function return types - Unknown + Yes 622 @@ -5117,7 +5117,7 @@ and POD class 873 C++11 Deducing rvalue references in declarative contexts - Unknown + Yes 874