forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Valentyn Yukhymenko <[email protected]>
- Loading branch information
1 parent
f6e7c78
commit 7142c95
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
libcxx/test/std/experimental/reflection/substitute.verify.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} | ||
} |