p2.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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. // FIXME: This is valid, see PR41192
  15. struct A {} // FIXME expected-error {{expected ';'}}
  16. ::import
  17. <empty.h>::a; // FIXME expected-error {{requires a type specifier}}
  18. // This is invalid: the tokens after 'import' are a header-name, so cannot be
  19. // parsed as a template-argument-list.
  20. struct B {}
  21. import // expected-error {{redefinition of 'import'}} expected-error {{expected ';'}}
  22. <empty.h>::b; // (error recovery skips these tokens)
  23. // Likewise, this is ill-formed after the tokens are reconstituted into a
  24. // header-name token.
  25. struct C {}
  26. import // expected-error {{redefinition of 'import'}} expected-error {{expected ';'}}
  27. <
  28. empty.h // (error recovery skips these tokens)
  29. >::c;