//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // // [ratio.general]/2 // Throughout subclause [ratio], the names of template parameters are // used to express type requirements. If a template parameter is named // R1 or R2, and the template argument is not a specialization of the // ratio template, the program is ill-formed. #include struct invalid { static const int num = 1; static const int den = 1; }; using valid = std::ratio<1, 1>; namespace add { using valid_valid = std::ratio_add::type; using invalid_valid = std::ratio_add::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} using valid_invalid = std::ratio_add::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} } // namespace add namespace subtract { using valid_valid = std::ratio_subtract::type; using invalid_valid = std::ratio_subtract::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} using valid_invalid = std::ratio_subtract::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} } // namespace subtract namespace multiply { using valid_valid = std::ratio_multiply::type; using invalid_valid = std::ratio_multiply::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} using valid_invalid = std::ratio_multiply::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} } // namespace multiply namespace divide { using valid_valid = std::ratio_divide::type; using invalid_valid = std::ratio_divide::type; // expected-error@*:* {{R1 to be a specialisation of the ratio template}} using valid_invalid = std::ratio_divide::type; // expected-error@*:* {{R2 to be a specialisation of the ratio template}} } // namespace divide