blob: 79213cae8fa26d4e6ec09f879d502cafb4dd3d4e [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 Smith65ebb4a2015-03-26 04:09:53 +00004
5// Trigger import of definitions, but don't make them visible.
6#include "empty.h"
7
8A pre_a; // expected-error {{must be imported}} expected-error {{must use 'struct'}}
Richard Smith9a71c992015-03-27 20:16:58 +00009// expected-note@defs.h:1 +{{here}}
10// FIXME: We should warn that use_a is being used without being imported.
11int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}}
Richard Smith65ebb4a2015-03-26 04:09:53 +000012
Richard Smithbe3980b2015-03-27 00:41:57 +000013B::Inner2 pre_bi; // expected-error +{{must be imported}}
14// expected-note@defs.h:4 +{{here}}
Richard Smithd6aab592015-03-27 21:57:41 +000015// expected-note@defs.h:11 +{{here}}
Richard Smithbe3980b2015-03-27 00:41:57 +000016
17C_Base<1> pre_cb1; // expected-error +{{must be imported}}
Richard Smithbe3980b2015-03-27 00:41:57 +000018// expected-note@defs.h:15 +{{here}}
Richard Smithd6aab592015-03-27 21:57:41 +000019C1 pre_c1; // expected-error +{{must be imported}} expected-error {{must use 'struct'}}
20// expected-note@defs.h:17 +{{here}}
Richard Smithbe3980b2015-03-27 00:41:57 +000021C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}}
Richard Smithd6aab592015-03-27 21:57:41 +000022// expected-note@defs.h:18 +{{here}}
Richard Smithbe3980b2015-03-27 00:41:57 +000023
Richard Smitha5230222015-03-27 01:37:43 +000024D::X pre_dx; // expected-error +{{must be imported}}
Richard Smithd6aab592015-03-27 21:57:41 +000025// expected-note@defs.h:20 +{{here}}
26// expected-note@defs.h:21 +{{here}}
Richard Smith9a71c992015-03-27 20:16:58 +000027// FIXME: We should warn that use_dx is being used without being imported.
28int pre_use_dx = use_dx(pre_dx);
Richard Smitha5230222015-03-27 01:37:43 +000029
Richard Smithd6aab592015-03-27 21:57:41 +000030int pre_e = E(0); // expected-error {{must be imported}}
31// expected-note@defs.h:24 +{{here}}
32
33int pre_ff = F<int>().f(); // expected-error +{{must be imported}}
34int pre_fg = F<int>().g<int>(); // expected-error +{{must be imported}}
35// expected-note@defs.h:26 +{{here}}
36
Richard Smith65ebb4a2015-03-26 04:09:53 +000037// Make definitions from second module visible.
Richard Smith02793752015-03-27 21:16:39 +000038#ifdef TEXTUAL
Richard Smith65ebb4a2015-03-26 04:09:53 +000039#include "import-and-redefine.h"
Richard Smith02793752015-03-27 21:16:39 +000040#else
41#include "merged-defs.h"
42#endif
Richard Smith65ebb4a2015-03-26 04:09:53 +000043
44A post_a;
Richard Smith9a71c992015-03-27 20:16:58 +000045int post_use_a = use_a(post_a);
Richard Smithbe3980b2015-03-27 00:41:57 +000046B::Inner2 post_bi;
47C_Base<1> post_cb1;
48C1 c1;
49C2 c2;
Richard Smitha5230222015-03-27 01:37:43 +000050D::X post_dx;
Richard Smith9a71c992015-03-27 20:16:58 +000051int post_use_dx = use_dx(post_dx);
Richard Smithd6aab592015-03-27 21:57:41 +000052int post_e = E(0);
53int post_ff = F<char>().f();
54int post_fg = F<char>().g<int>();