mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 08:51:04 +01:00
Only export each class or namespace to C++ once. (#7042)
Instead of exporting a class or namespace each time a new C++ name lookup discovers it, track that we have exported the entity on its name scope, and if a new name lookup finds the same entity, produce the same clang declaration.
This commit is contained in:
@@ -107,3 +107,17 @@ inline Cpp '''
|
||||
// CHECK:STDERR:
|
||||
static_assert(sizeof(Carbon::A) == 2 * sizeof(int));
|
||||
''';
|
||||
|
||||
// --- alias_identity.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class A {}
|
||||
alias B = A;
|
||||
|
||||
inline Cpp '''
|
||||
// OK, Carbon::A and Carbon::B are the same type.
|
||||
Carbon::A *pa;
|
||||
Carbon::B *pb = pa;
|
||||
''';
|
||||
|
||||
Reference in New Issue
Block a user