xref: /minix3/external/bsd/llvm/dist/clang/test/Modules/submodules.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*f4a2713aSLionel Sambuc // RUN: rm -rf %t
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules %s -verify
3*f4a2713aSLionel Sambuc // FIXME: When we have a syntax for modules in C++, use that.
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc @import std.vector;
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc vector<int> vi;
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc // Note: remove_reference is not visible yet.
10*f4a2713aSLionel Sambuc remove_reference<int&>::type *int_ptr = 0; // expected-error{{declaration of 'remove_reference' must be imported from module 'std.type_traits' before it is required}}
11*f4a2713aSLionel Sambuc // expected-note@Inputs/submodules/type_traits.h:2{{previous}}
12*f4a2713aSLionel Sambuc // expected-note@Inputs/submodules/hash_map.h:1{{previous}}
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc @import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc vector<float> vf;
17*f4a2713aSLionel Sambuc remove_reference<int&>::type *int_ptr2 = 0;
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc @import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc @import std; // import everything in 'std'
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc // hash_map still isn't available.
24*f4a2713aSLionel Sambuc hash_map<int, float> ints_to_floats; // expected-error{{declaration of 'hash_map' must be imported from module 'std.hash_map' before it is required}}
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc @import std.hash_map;
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc hash_map<int, float> ints_to_floats2;
29