| // Tests that the ODR check wouldn't produce false-positive result for preferred_name attribute. |
| // RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm |
| // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use.cppm -verify -fsyntax-only |
| // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use1.cpp -verify -fsyntax-only |
| // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use2.cpp -verify -fsyntax-only |
| // Test again with reduced BMI. |
| // RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm |
| // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use.cppm -verify -fsyntax-only |
| // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use1.cpp -verify -fsyntax-only |
| // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use2.cpp -verify -fsyntax-only |
| typedef foo_templ<char> foo; |
| __attribute__((__preferred_name__(foo))) |
| inline foo_templ<char> bar() |
| return foo_templ<char>(); |
| export using ::foo_templ; |
| // expected-no-diagnostics |
| export using ::foo_templ; |
| import A; // expected-warning@foo.h:8 {{attribute declaration must precede definition}} |
| #include "foo.h" // expected-note@foo.h:9 {{previous definition is here}} |
| // expected-no-diagnostics |