export.carbon 928 B

123456789101112131415161718192021222324252627282930
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/namespace/export.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/namespace/export.carbon
  12. // --- alias_identity.carbon
  13. import Cpp;
  14. namespace M;
  15. alias N = M;
  16. class M.C {}
  17. inline Cpp '''
  18. // OK, valid redeclaration: M and N are the same namespace.
  19. namespace A = Carbon::M;
  20. namespace A = Carbon::N;
  21. // Valid: M::C and N::C are the same class.
  22. Carbon::M::C *pmc;
  23. Carbon::N::C *pnc = pmc;
  24. ''';