Skip to content

Commit

Permalink
tests for substitute
Browse files Browse the repository at this point in the history
Signed-off-by: Valentyn Yukhymenko <[email protected]>
  • Loading branch information
BaLiKfromUA committed Nov 8, 2024
1 parent f6e7c78 commit 7142c95
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions libcxx/test/std/experimental/reflection/substitute.verify.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//===----------------------------------------------------------------------===//
//
// Copyright 2024 Bloomberg Finance L.P.
//
// 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
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03 || c++11 || c++14 || c++17 || c++20
// ADDITIONAL_COMPILE_FLAGS: -freflection -freflection-new-syntax
// ADDITIONAL_COMPILE_FLAGS: -Wno-unused-variable -Wno-unused-value

// <experimental/reflection>
//
// [reflection]

#include <experimental/meta>
#include <vector>

int main() {
can_substitute(^^std::vector, {^^int}); //ok
substitute(^^std::vector, {^^int}); //ok

can_substitute(^^int, {^^int});
// expected-error-re@-1 {{call to consteval function 'std::meta::can_substitute<{{.*}}>' is not a constant expression}}
// expected-note-re@-2 {{expected a reflection of a template, but got {{.*}}}}

substitute(^^int, {^^int});
// expected-error-re@-1 {{call to consteval function 'std::meta::substitute<{{.*}}>' is not a constant expression}}
// expected-note-re@-2 {{expected a reflection of a template, but got {{.*}}}}

substitute(^^std::vector, {^^::});
// expected-error-re@-1 {{call to consteval function 'std::meta::substitute<{{.*}}>' is not a constant expression}}
// expected-note-re@-2 {{a reflection of {{.*}} cannot represent a template argument}}
}

0 comments on commit 7142c95

Please sign in to comment.