blob: 0e2f5d9e546859d69750e54d70d235f9907d7a32 [file] [log] [blame]
Richard Smith65ebb4a2015-03-26 04:09:53 +00001// RUN: rm -rf %t
Richard Smith02793752015-03-27 21:16:39 +00002// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -DTEXTUAL
Richard Smithbe3980b2015-03-27 00:41:57 +00003// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery
Richard Smith42413142015-05-15 20:05:43 +00004// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -DTEXTUAL
5// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility
Richard Smith65ebb4a2015-03-26 04:09:53 +00006
7// Trigger import of definitions, but don't make them visible.
8#include "empty.h"
9
10A pre_a; // expected-error {{must be imported}} expected-error {{must use 'struct'}}
Richard Smith9a71c992015-03-27 20:16:58 +000011// expected-note@defs.h:1 +{{here}}
12// FIXME: We should warn that use_a is being used without being imported.
13int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}}
Richard Smith65ebb4a2015-03-26 04:09:53 +000014
Richard Smithbe3980b2015-03-27 00:41:57 +000015B::Inner2 pre_bi; // expected-error +{{must be imported}}
16// expected-note@defs.h:4 +{{here}}
Richard Smithd6aab592015-03-27 21:57:41 +000017// expected-note@defs.h:11 +{{here}}
Richard Smithbe3980b2015-03-27 00:41:57 +000018
19C_Base<1> pre_cb1; // expected-error +{{must be imported}}
Richard Smithbe3980b2015-03-27 00:41:57 +000020// expected-note@defs.h:15 +{{here}}
Richard Smithd6aab592015-03-27 21:57:41 +000021C1 pre_c1; // expected-error +{{must be imported}} expected-error {{must use 'struct'}}
22// expected-note@defs.h:17 +{{here}}
Richard Smithbe3980b2015-03-27 00:41:57 +000023C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}}
Richard Smithd6aab592015-03-27 21:57:41 +000024// expected-note@defs.h:18 +{{here}}
Richard Smithbe3980b2015-03-27 00:41:57 +000025
Richard Smitha5230222015-03-27 01:37:43 +000026D::X pre_dx; // expected-error +{{must be imported}}
Richard Smithd6aab592015-03-27 21:57:41 +000027// expected-note@defs.h:20 +{{here}}
28// expected-note@defs.h:21 +{{here}}
Richard Smith9a71c992015-03-27 20:16:58 +000029// FIXME: We should warn that use_dx is being used without being imported.
30int pre_use_dx = use_dx(pre_dx);
Richard Smitha5230222015-03-27 01:37:43 +000031
Richard Smithd6aab592015-03-27 21:57:41 +000032int pre_e = E(0); // expected-error {{must be imported}}
33// expected-note@defs.h:24 +{{here}}
34
35int pre_ff = F<int>().f(); // expected-error +{{must be imported}}
36int pre_fg = F<int>().g<int>(); // expected-error +{{must be imported}}
37// expected-note@defs.h:26 +{{here}}
38
Richard Smith65ebb4a2015-03-26 04:09:53 +000039// Make definitions from second module visible.
Richard Smith02793752015-03-27 21:16:39 +000040#ifdef TEXTUAL
Richard Smith65ebb4a2015-03-26 04:09:53 +000041#include "import-and-redefine.h"
Richard Smith02793752015-03-27 21:16:39 +000042#else
43#include "merged-defs.h"
44#endif
Richard Smith65ebb4a2015-03-26 04:09:53 +000045
46A post_a;
Richard Smith9a71c992015-03-27 20:16:58 +000047int post_use_a = use_a(post_a);
Richard Smithbe3980b2015-03-27 00:41:57 +000048B::Inner2 post_bi;
49C_Base<1> post_cb1;
50C1 c1;
51C2 c2;
Richard Smitha5230222015-03-27 01:37:43 +000052D::X post_dx;
Richard Smith9a71c992015-03-27 20:16:58 +000053int post_use_dx = use_dx(post_dx);
Richard Smithd6aab592015-03-27 21:57:41 +000054int post_e = E(0);
55int post_ff = F<char>().f();
56int post_fg = F<char>().g<int>();