[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / merge-concepts-redefinition-error.cpp
blob844a4833bf7c255fb50b54ecdce3a287f1498b98
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"
17 module "conflicting" {
18 export *
19 header "conflicting.h"
23 //--- concepts.h
24 #ifndef CONCEPTS_H_
25 #define CONCEPTS_H_
27 template <class T>
28 concept ConflictingConcept = true;
30 template <class T, class U>
31 concept same_as = __is_same(T, U);
33 template<class T> concept truec = true;
35 int var;
37 #endif // SAMEAS_CONCEPTS_H
39 //--- conflicting.h
40 #ifndef CONFLICTING_H
41 #define CONFLICTING_H
43 #include "concepts.h"
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}}
49 int same_as; // expected-error {{redefinition of 'same_as' as different kind of symbol}}
50 // expected-note@* {{previous definition}}
52 template<class T> concept var = false; // expected-error {{redefinition of 'var' as different kind of symbol}}
53 // expected-note@* {{previous definition}}
55 template<class T> concept truec = true; // expected-error {{redefinition of 'truec'}}
56 // expected-note@* {{previous definition}}
57 #endif // CONFLICTING_H