p2.cpp 1014 B

1234567891011121314151617181920212223242526272829303132
  1. // RUN: %clang_cc1 -std=c++2a -emit-header-module -fmodule-name=attrs -x c++-header %S/Inputs/empty.h %S/Inputs/attrs.h -o %t.pcm
  2. // RUN: %clang_cc1 -std=c++2a %s -fmodule-file=%t.pcm -fsyntax-only -verify -I%S/Inputs
  3. template<int> struct import; // expected-note 2{{previous}}
  4. constexpr struct { int h; } empty = {0};
  5. struct A;
  6. struct B;
  7. struct C;
  8. template<> struct import<0> {
  9. static A a;
  10. static B b;
  11. static C c;
  12. };
  13. // OK, not an import-declaration.
  14. struct A {}
  15. ::import
  16. <empty.h>::a;
  17. // This is invalid: the tokens after 'import' are a header-name, so cannot be
  18. // parsed as a template-argument-list.
  19. struct B {}
  20. import // expected-error {{redefinition of 'import'}} expected-error {{expected ';'}}
  21. <empty.h>::b; // (error recovery skips these tokens)
  22. // Likewise, this is ill-formed after the tokens are reconstituted into a
  23. // header-name token.
  24. struct C {}
  25. import // expected-error {{redefinition of 'import'}} expected-error {{expected ';'}}
  26. <
  27. empty.h // (error recovery skips these tokens)
  28. >::c;