| 1 |
// P2615R1 invalid declarations |
| 2 |
// PR c++/107688 |
| 3 |
// { dg-additional-options "-fmodules-ts" } |
| 4 |
// { dg-module-cmi !bad } |
| 5 |
|
| 6 |
export module bad; |
| 7 |
|
| 8 |
extern "C++" export void foo(); // { dg-error "export-declarations are not permitted here" "" { target c++20 } } |
| 9 |
|
| 10 |
export template <typename T> struct S {}; |
| 11 |
|
| 12 |
export template <typename T> struct S<T*> {}; // { dg-error "partial specialization in unbraced export-declaration" } |
| 13 |
|
| 14 |
export template <> struct S<int*> {}; // { dg-error "explicit specializations are not permitted here" } |
| 15 |
|
| 16 |
export template struct S<int>; // { dg-error "explicit instantiations are not permitted here" } |
| 17 |
|
| 18 |
template <> export struct S<double>; // { dg-error "expected unqualified-id" } |
| 19 |
|
| 20 |
export export int x; // { dg-error ".export. may only occur once" } |
| 21 |
|
| 22 |
export { export int y; } // { dg-error ".export. may only occur once" } |
| 23 |
|
| 24 |
namespace { |
| 25 |
export namespace ns {} // { dg-error "internal linkage" } |
| 26 |
} |
| 27 |
|
| 28 |
export namespace {} // { dg-error "exporting unnamed namespace" } |