1// RUN: rm -rf %t.cache
2// RUN: %clang_cc1 -fsyntax-only %s -fmodules -fmodules-cache-path=%t.cache \
3// RUN:   -fimplicit-module-maps -Wno-private-module -F%S/Inputs -verify
4// RUN: %clang_cc1 -fsyntax-only %s -fmodules -fmodules-cache-path=%t.cache \
5// RUN:   -fimplicit-module-maps -Wno-private-module -F%S/Inputs -DCHANGE_TAGS -verify
6#include "F/F.h"
7
8#ifndef CHANGE_TAGS
9// expected-no-diagnostics
10#endif
11
12struct NS {
13  int a;
14#ifndef CHANGE_TAGS
15  int b;
16#else
17  int c; // expected-note {{field has name 'c' here}}
18  // expected-error@redefinition-c-tagtypes.m:12 {{type 'struct NS' has incompatible definitions}}
19  // expected-note@Inputs/F.framework/PrivateHeaders/NS.h:3 {{field has name 'b' here}}
20#endif
21};
22
23enum NSE {
24  FST = 22,
25#ifndef CHANGE_TAGS
26  SND = 43,
27#else
28  SND = 44, // expected-note {{enumerator 'SND' with value 44 here}}
29  // expected-error@redefinition-c-tagtypes.m:23 {{type 'enum NSE' has incompatible definitions}}
30  // expected-note@Inputs/F.framework/PrivateHeaders/NS.h:8 {{enumerator 'SND' with value 43 here}}
31#endif
32  TRD = 55
33};
34
35#define NS_ENUM(_type, _name) \
36  enum _name : _type _name;   \
37  enum _name : _type
38
39typedef NS_ENUM(int, NSMyEnum) {
40  MinX = 11,
41#ifndef CHANGE_TAGS
42  MinXOther = MinX,
43#else
44  MinXOther = TRD, // expected-note {{enumerator 'MinXOther' with value 55 here}}
45  // expected-error@redefinition-c-tagtypes.m:39 {{type 'enum NSMyEnum' has incompatible definitions}}
46  // expected-note@Inputs/F.framework/PrivateHeaders/NS.h:18 {{enumerator 'MinXOther' with value 11 here}}
47#endif
48};
49