blob: 86e50368a9ea153b6f32d8d4f792329f1b14d7ee [file] [log] [blame]
Richard Smith65ebb4a2015-03-26 04:09:53 +00001// RUN: rm -rf %t
Richard Smithbe3980b2015-03-27 00:41:57 +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
Richard Smith65ebb4a2015-03-26 04:09:53 +00003
4// Trigger import of definitions, but don't make them visible.
5#include "empty.h"
6
7A pre_a; // expected-error {{must be imported}} expected-error {{must use 'struct'}}
Richard Smith9a71c992015-03-27 20:16:58 +00008// expected-note@defs.h:1 +{{here}}
9// FIXME: We should warn that use_a is being used without being imported.
10int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}}
Richard Smith65ebb4a2015-03-26 04:09:53 +000011
Richard Smithbe3980b2015-03-27 00:41:57 +000012B::Inner2 pre_bi; // expected-error +{{must be imported}}
13// expected-note@defs.h:4 +{{here}}
14// expected-note@defs.h:10 +{{here}}
15
16C_Base<1> pre_cb1; // expected-error +{{must be imported}}
17// expected-note@defs.h:13 +{{here}}
18C1 pre_c1; // expected-error +{{must be imported}} expected-error {{must use 'struct'}}
19// expected-note@defs.h:15 +{{here}}
20C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}}
21// expected-note@defs.h:16 +{{here}}
22
Richard Smitha5230222015-03-27 01:37:43 +000023D::X pre_dx; // expected-error +{{must be imported}}
24// expected-note@defs.h:18 +{{here}}
25// expected-note@defs.h:19 +{{here}}
Richard Smith9a71c992015-03-27 20:16:58 +000026// FIXME: We should warn that use_dx is being used without being imported.
27int pre_use_dx = use_dx(pre_dx);
Richard Smitha5230222015-03-27 01:37:43 +000028
Richard Smith65ebb4a2015-03-26 04:09:53 +000029// Make definitions from second module visible.
30#include "import-and-redefine.h"
31
32A post_a;
Richard Smith9a71c992015-03-27 20:16:58 +000033int post_use_a = use_a(post_a);
Richard Smithbe3980b2015-03-27 00:41:57 +000034B::Inner2 post_bi;
35C_Base<1> post_cb1;
36C1 c1;
37C2 c2;
Richard Smitha5230222015-03-27 01:37:43 +000038D::X post_dx;
Richard Smith9a71c992015-03-27 20:16:58 +000039int post_use_dx = use_dx(post_dx);