[PATCH] D134578: Add missing `struct` keyword to the test p2-2.cpp

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 26 01:51:35 PDT 2022


ilya-biryukov added subscribers: ChuanqiXu, ilya-biryukov.
ilya-biryukov added a reviewer: ChuanqiXu.
ilya-biryukov added a comment.

LGTM. I believe the standard is clear here, the declaration inside `export` does not have any special treatment in terms of how it must be parsed.

@ChuanqiXu could you confirm my reasoning?

Two more related rants follow.

It is unclear why the test did not produce any errors about these forward declarations being invalid in the first place.
Forward declaration cannot <https://gcc.godbolt.org/z/YjxGK9r88> have a nested name specifier, even if all `export` restrictions are met, we will still get the error.
I suppose we aim to produce fewer errors here, so showing only one of the two errors makes sense. However, I feel that the preference should be given to "invalid forward declaration" as it occurs "deeper" and makes the exported construct invalid in the first place. Hence, any attempt to interpret the invalid exported declaration can mask the original error. What do others think?

The standard says in (module.interface)p3 <https://eel.is/c++draft/module.interface#3>: `An exported declaration that is not a module-import-declaration shall declare at least one name`. Should the "declaration does not declare anything" be promoted to error when inside export declaration?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134578



More information about the cfe-commits mailing list