[PATCH] D113545: [C++20] [Module] Support reachable definition initially/partially

Iain Sandoe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 21 03:48:30 PDT 2022


iains added a comment.

as suspected, we also have a missing diagnostic in 10.7 ex1

  // RUN: rm -rf %t
  // RUN: split-file %s %t
  // RUN: cd %t
  
  // RUN: %clang_cc1 -std=c++20 -emit-module-interface std-10-7-ex1-M-A.cpp \
  // RUN: -o M-A.pcm
  
  // RUN: %clang_cc1 -std=c++20 -emit-module-interface std-10-7-ex1-M-B.cpp \
  // RUN: -o M-B.pcm
  
  // RUN: %clang_cc1 -std=c++20 -emit-module-interface std-10-7-ex1-M-C.cpp \
  // RUN: -fmodule-file=M-A.pcm -verify -fsyntax-only
  
  // RUN: %clang_cc1 -std=c++20 -emit-module-interface std-10-7-ex1-M.cpp \
  // RUN: -o M.pcm -fmodule-file=M-A.pcm -fmodule-file=M-B.pcm
  
  // RUN: %clang_cc1 -std=c++20 -emit-module-interface std-10-7-ex1-X.cpp \
  // RUN: -o X.pcm
  
  // RUN: %clang_cc1 -std=c++20 std-10-7-ex1-use.cpp -fsyntax-only \
  // RUN: -fmodule-file=M.pcm -fmodule-file=X.pcm -verify
  
  //--- std-10-7-ex1-M-A.cpp
  export module M:A;
  export struct B;
  
  //--- std-10-7-ex1-M-B.cpp
  module M:B;
  struct B {
    operator int();
  };
  
  //--- std-10-7-ex1-M-C.cpp
  module M:C;
  import :A;
  B b1;   // expected-error {{variable has incomplete type 'B'}} 
          // expected-note at std-10-7-ex1-M-A.cpp:2 {{forward declaration of 'B'}}
  //--- std-10-7-ex1-M.cpp
  export module M;
  export import :A;
  import :B;
  B b2;
  export void f(B b = B());
  
  //--- std-10-7-ex1-X.cpp
  export module X;
  
  //--- std-10-7-ex1-use.cpp
  module X;
  import M;
  B b3;     // expected-error 1+{{definition of 'B' must be imported from module 'M:B' before it is required}} 
            // expected-note at std-10-7-ex1-M-B.cpp:2 1+{{definition here is not reachable}}
  void g() { f(); }  // expected-error {{definition of 'B' must be imported from module 'M:B' before it is required}}
    // not sure of the actual diagnostic here ^ , it is not emitted.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113545/new/

https://reviews.llvm.org/D113545



More information about the cfe-commits mailing list