1 // Tests that the ODR check wouldn't produce false-positive result for preferred_name attribute.
5 // RUN: split-file %s %t
7 // RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm
8 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use.cppm -verify -fsyntax-only
9 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use1.cpp -verify -fsyntax-only
10 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use2.cpp -verify -fsyntax-only
12 // Test again with reduced BMI.
15 // RUN: split-file %s %t
17 // RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm
18 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use.cppm -verify -fsyntax-only
19 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use1.cpp -verify -fsyntax-only
20 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use2.cpp -verify -fsyntax-only
23 template<class _CharT>
26 typedef foo_templ<char> foo;
28 template<class _CharT>
30 __attribute__((__preferred_name__(foo)))
36 inline foo_templ<char> bar()
38 return foo_templ<char>();
45 export using ::foo_templ;
48 // expected-no-diagnostics
53 export using ::foo_templ;
56 import A; // expected-warning@foo.h:8 {{attribute declaration must precede definition}}
57 #include "foo.h" // expected-note@foo.h:9 {{previous definition is here}}
60 // expected-no-diagnostics