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
13 template<class _CharT>
16 typedef foo_templ<char> foo;
18 template<class _CharT>
20 __attribute__((__preferred_name__(foo)))
26 inline foo_templ<char> bar()
28 return foo_templ<char>();
37 // expected-no-diagnostics
44 import A; // expected-warning@foo.h:8 {{attribute declaration must precede definition}}
45 #include "foo.h" // expected-note@foo.h:9 {{previous definition is here}}
48 // expected-no-diagnostics