blob: e7c0ad7f0c1cbda7d5579ad8cd6e64cfed8a1d97 [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 Smith00be6d02015-06-11 03:05:39 +00006// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodule-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -DTEXTUAL -DEARLY_INDIRECT_INCLUDE
Richard Smith65ebb4a2015-03-26 04:09:53 +00007
8// Trigger import of definitions, but don't make them visible.
9#include "empty.h"
Richard Smith00be6d02015-06-11 03:05:39 +000010#ifdef EARLY_INDIRECT_INCLUDE
11#include "indirect.h"
12#endif
Richard Smith65ebb4a2015-03-26 04:09:53 +000013
14A pre_a; // expected-error {{must be imported}} expected-error {{must use 'struct'}}
Richard Smith9a71c992015-03-27 20:16:58 +000015// expected-note@defs.h:1 +{{here}}
16// FIXME: We should warn that use_a is being used without being imported.
17int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}}
Richard Smith65ebb4a2015-03-26 04:09:53 +000018
Richard Smithbe3980b2015-03-27 00:41:57 +000019B::Inner2 pre_bi; // expected-error +{{must be imported}}
20// expected-note@defs.h:4 +{{here}}
Richard Smithd6aab592015-03-27 21:57:41 +000021// expected-note@defs.h:11 +{{here}}
Richard Smithbe3980b2015-03-27 00:41:57 +000022
23C_Base<1> pre_cb1; // expected-error +{{must be imported}}
Richard Smithbe3980b2015-03-27 00:41:57 +000024// expected-note@defs.h:15 +{{here}}
Richard Smithd6aab592015-03-27 21:57:41 +000025C1 pre_c1; // expected-error +{{must be imported}} expected-error {{must use 'struct'}}
26// expected-note@defs.h:17 +{{here}}
Richard Smithbe3980b2015-03-27 00:41:57 +000027C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}}
Richard Smithd6aab592015-03-27 21:57:41 +000028// expected-note@defs.h:18 +{{here}}
Richard Smithbe3980b2015-03-27 00:41:57 +000029
Richard Smitha5230222015-03-27 01:37:43 +000030D::X pre_dx; // expected-error +{{must be imported}}
Richard Smithd6aab592015-03-27 21:57:41 +000031// expected-note@defs.h:20 +{{here}}
32// expected-note@defs.h:21 +{{here}}
Richard Smith9a71c992015-03-27 20:16:58 +000033// FIXME: We should warn that use_dx is being used without being imported.
34int pre_use_dx = use_dx(pre_dx);
Richard Smitha5230222015-03-27 01:37:43 +000035
Richard Smithd6aab592015-03-27 21:57:41 +000036int pre_e = E(0); // expected-error {{must be imported}}
37// expected-note@defs.h:24 +{{here}}
38
39int pre_ff = F<int>().f(); // expected-error +{{must be imported}}
40int pre_fg = F<int>().g<int>(); // expected-error +{{must be imported}}
41// expected-note@defs.h:26 +{{here}}
42
Richard Smithc7852762015-06-11 23:46:11 +000043J<> pre_j; // expected-error {{must be imported}} expected-error {{too few}}
44// expected-note@defs.h:49 +{{here}}
45
Richard Smith65ebb4a2015-03-26 04:09:53 +000046// Make definitions from second module visible.
Richard Smith02793752015-03-27 21:16:39 +000047#ifdef TEXTUAL
Richard Smith65ebb4a2015-03-26 04:09:53 +000048#include "import-and-redefine.h"
Richard Smith02793752015-03-27 21:16:39 +000049#else
50#include "merged-defs.h"
51#endif
Richard Smith65ebb4a2015-03-26 04:09:53 +000052
53A post_a;
Richard Smith9a71c992015-03-27 20:16:58 +000054int post_use_a = use_a(post_a);
Richard Smithbe3980b2015-03-27 00:41:57 +000055B::Inner2 post_bi;
56C_Base<1> post_cb1;
57C1 c1;
58C2 c2;
Richard Smitha5230222015-03-27 01:37:43 +000059D::X post_dx;
Richard Smith9a71c992015-03-27 20:16:58 +000060int post_use_dx = use_dx(post_dx);
Richard Smithd6aab592015-03-27 21:57:41 +000061int post_e = E(0);
62int post_ff = F<char>().f();
63int post_fg = F<char>().g<int>();
Richard Smith00be6d02015-06-11 03:05:39 +000064#ifdef EARLY_INDIRECT_INCLUDE
65// FIXME: Properly track the owning module for a member specialization.
66// expected-error@defs.h:34 {{redefinition}}
67// expected-note@defs.h:34 {{previous definition}}
68// expected-error@-5 {{no matching member function}}
69// expected-note@defs.h:34 {{substitution failure}}
70#endif
Richard Smithc7852762015-06-11 23:46:11 +000071J<> post_j;
72template<typename T, int N, template<typename> class K> struct J;
73J<> post_j2;