58 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir %t3// RUN: split-file %s %t4//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: -verify9//10//--- modules.map11module "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.h24#ifndef CONCEPTS_H_25#define CONCEPTS_H_26 27template <class T>28concept ConflictingConcept = true;29 30template <class T, class U>31concept same_as = __is_same(T, U);32 33template<class T> concept truec = true;34 35int var;36 37#endif // SAMEAS_CONCEPTS_H38 39//--- conflicting.h40#ifndef CONFLICTING_H41#define CONFLICTING_H42 43#include "concepts.h"44 45template <class T, class U = int>46concept ConflictingConcept = true; // expected-error {{redefinition of concept 'ConflictingConcept' with different template}}47 // expected-note@* {{previous definition}}48 49int same_as; // expected-error {{redefinition of 'same_as' as different kind of symbol}}50 // expected-note@* {{previous definition}}51 52template<class T> concept var = false; // expected-error {{redefinition of 'var' as different kind of symbol}}53 // expected-note@* {{previous definition}}54 55template<class T> concept truec = true; // expected-error {{redefinition of 'truec'}}56 // expected-note@* {{previous definition}}57#endif // CONFLICTING_H58