blob: 3bc52fee828f3bc487cf52aef58f032e6abf9c66 [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}}
15// expected-note@defs.h:10 +{{here}}
16
17C_Base<1> pre_cb1; // expected-error +{{must be imported}}
18// expected-note@defs.h:13 +{{here}}
19C1 pre_c1; // expected-error +{{must be imported}} expected-error {{must use 'struct'}}
20// expected-note@defs.h:15 +{{here}}
21C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}}
22// expected-note@defs.h:16 +{{here}}
23
Richard Smitha5230222015-03-27 01:37:43 +000024D::X pre_dx; // expected-error +{{must be imported}}
25// expected-note@defs.h:18 +{{here}}
26// expected-note@defs.h:19 +{{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 Smith65ebb4a2015-03-26 04:09:53 +000030// Make definitions from second module visible.
Richard Smith02793752015-03-27 21:16:39 +000031#ifdef TEXTUAL
Richard Smith65ebb4a2015-03-26 04:09:53 +000032#include "import-and-redefine.h"
Richard Smith02793752015-03-27 21:16:39 +000033#else
34#include "merged-defs.h"
35#endif
Richard Smith65ebb4a2015-03-26 04:09:53 +000036
37A post_a;
Richard Smith9a71c992015-03-27 20:16:58 +000038int post_use_a = use_a(post_a);
Richard Smithbe3980b2015-03-27 00:41:57 +000039B::Inner2 post_bi;
40C_Base<1> post_cb1;
41C1 c1;
42C2 c2;
Richard Smitha5230222015-03-27 01:37:43 +000043D::X post_dx;
Richard Smith9a71c992015-03-27 20:16:58 +000044int post_use_dx = use_dx(post_dx);