Skip to content
Snippets Groups Projects
  • Iain Sandoe's avatar
    f60dc3ca
    [C++20][Modules] Adjust handling of exports of namespaces and using-decls. · f60dc3ca
    Iain Sandoe authored
    This adjusts the handling for:
    
    export module  M;
    
    export namespace {};
    
    export namespace N {};
    export using namespace N;
    
    In the first case, we were allowing empty anonymous namespaces
    as part of an extension allowing empty top-level entities, but that seems
    inappropriate in this case, since the linkage would be internal for the
    anonymous namespace.  We now report an error for this.
    
    The second case was producing a warning diagnostic that this was
    accepted as an extension - however the C++20 standard does allow this
    as well-formed.
    
    In the third case we keep the current practice that this is accepted with a
    warning (as an extension). The C++20 standard says it's an error.
    
    We also ensure that using decls are only applied to items with external linkage.
    
    This adjusts error messages for exports involving redeclarations in modules to
    be more specific about the reason that the decl has been rejected.
    
    Differential Revision: https://reviews.llvm.org/D122119
    f60dc3ca
    History
    [C++20][Modules] Adjust handling of exports of namespaces and using-decls.
    Iain Sandoe authored
    This adjusts the handling for:
    
    export module  M;
    
    export namespace {};
    
    export namespace N {};
    export using namespace N;
    
    In the first case, we were allowing empty anonymous namespaces
    as part of an extension allowing empty top-level entities, but that seems
    inappropriate in this case, since the linkage would be internal for the
    anonymous namespace.  We now report an error for this.
    
    The second case was producing a warning diagnostic that this was
    accepted as an extension - however the C++20 standard does allow this
    as well-formed.
    
    In the third case we keep the current practice that this is accepted with a
    warning (as an extension). The C++20 standard says it's an error.
    
    We also ensure that using decls are only applied to items with external linkage.
    
    This adjusts error messages for exports involving redeclarations in modules to
    be more specific about the reason that the decl has been rejected.
    
    Differential Revision: https://reviews.llvm.org/D122119
Code owners
Assign users and groups as approvers for specific file changes. Learn more.