brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · bf2d126 Raw
35 lines · cpp
1// RUN: %clang_cc1 -std=c++98 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s2// RUN: %clang_cc1 -std=c++11 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s3// RUN: %clang_cc1 -std=c++14 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s4// RUN: %clang_cc1 -std=c++17 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s5// RUN: %clang_cc1 -std=c++20 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s6// RUN: %clang_cc1 -std=c++23 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s7// RUN: %clang_cc1 -std=c++2c %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s8 9// expected-no-diagnostics10 11namespace cwg1818 { // cwg1818: 3.412extern "C" void f() {13  // This declaration binds name 'g' in the scope of function 'f',14  // but its target scope corresponds to namespace 'cwg1818' (_N4988_.[dcl.meaning]/3.5).15  // Linkage specification of 'f' applies to 'g' per _N4988_.[dcl.link]/5.16  void g();17}18// Target scope of this declaration is naturally the one19// that corresponds to namespace 'cwg1818',20// which makes it declare the same entity21// as the previous declaration per _N4988_.[basic.link]/8,22// turning it into a redeclaration per _N4988_.[basic.def]/1.23// Then _N4988_.[dcl.link]/6 applies, making it inherit24// the (С) language linkage of the previous declaration.25void g();26} // namespace cwg181827 28// Check that the former 'g' has C language linkage,29// then that the latter 'g' is considered to be a redeclaration of it,30// which would make the latter 'g' inherit C language linkage from the former 'g'.31 32// CHECK: LinkageSpecDecl [[LINKAGE_DECL:0x[0-9a-f]+]] {{.*}} C33// CHECK: FunctionDecl [[FIRST_DECL:0x[0-9a-f]+]] parent [[LINKAGE_DECL]] {{.*}} g 'void ()'34// CHECK: FunctionDecl {{.*}} prev [[FIRST_DECL]] {{.*}} g 'void ()'35