1 // RUN: rm -rf %t 2 // RUN: mkdir %t 3 // RUN: split-file %s %t 4 // 5 // RUN: %clang_cc1 -xc++ -std=c++20 -fmodules -fmodule-name=library \ 6 // RUN: -emit-module %t/modules.map \ 7 // RUN: -o %t/module.pcm \ 8 // RUN: -verify 9 // 10 //--- modules.map 11 module "library" { 12 export * 13 module "concepts" { 14 export * 15 header "concepts.h" 16 } 17 module "conflicting" { 18 export * 19 header "conflicting.h" 20 } 21 } 22 23 //--- concepts.h 24 #ifndef CONCEPTS_H_ 25 #define CONCEPTS_H_ 26 27 template <class T> 28 concept ConflictingConcept = true; 29 30 template <class T, class U> 31 concept same_as = __is_same(T, U); 32 33 template<class T> concept truec = true; 34 35 int var; 36 37 #endif // SAMEAS_CONCEPTS_H 38 39 //--- conflicting.h 40 #ifndef CONFLICTING_H 41 #define CONFLICTING_H 42 43 #include "concepts.h" 44 45 template <class T, class U = int> 46 concept ConflictingConcept = true; // expected-error {{redefinition of concept 'ConflictingConcept' with different template}} 47 // expected-note@* {{previous definition}} 48 49 int same_as; // expected-error {{redefinition of 'same_as' as different kind of symbol}} 50 // expected-note@* {{previous definition}} 51 52 template<class T> concept var = false; // expected-error {{redefinition of 'var' as different kind of symbol}} 53 // expected-note@* {{previous definition}} 54 55 template<class T> concept truec = true; // expected-error {{redefinition of 'truec'}} 56 // expected-note@* {{previous definition}} 57 #endif // CONFLICTING_H 58