CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
77 lines
2.2 KiB
C++
77 lines
2.2 KiB
C++
// RUN: rm -fR %t
|
|
// RUN: split-file %s %t
|
|
// RUN: cd %t
|
|
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header -Werror=uninitialized folly-conv.h
|
|
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header -Werror=uninitialized thrift_cpp2_base.h
|
|
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header -Werror=uninitialized -fmodule-file=folly-conv.pcm -fmodule-file=thrift_cpp2_base.pcm logger_base.h
|
|
|
|
//--- Conv.h
|
|
#pragma once
|
|
|
|
template <typename _Tp, typename _Up = _Tp&&>
|
|
_Up __declval(int);
|
|
|
|
template <typename _Tp>
|
|
auto declval() noexcept -> decltype(__declval<_Tp>(0));
|
|
|
|
namespace folly {
|
|
|
|
template <class Value, class Error>
|
|
struct Expected {
|
|
template <class Yes>
|
|
auto thenOrThrow() -> decltype(declval<Value&>()) {
|
|
return 1;
|
|
}
|
|
};
|
|
|
|
struct ExpectedHelper {
|
|
template <class Error, class T>
|
|
static constexpr Expected<T, Error> return_(T) {
|
|
return Expected<T, Error>();
|
|
}
|
|
|
|
template <class This, class Fn, class E = int, class T = ExpectedHelper>
|
|
static auto then_(This&&, Fn&&)
|
|
-> decltype(T::template return_<E>((declval<Fn>()(true), 0))) {
|
|
return Expected<int, int>();
|
|
}
|
|
};
|
|
|
|
template <class Tgt>
|
|
inline Expected<Tgt, const char*> tryTo() {
|
|
Tgt result = 0;
|
|
// In build with asserts:
|
|
// clang/lib/Sema/SemaTemplateInstantiate.cpp: llvm::PointerUnion<Decl *, LocalInstantiationScope::DeclArgumentPack *> *clang::LocalInstantiationScope::findInstantiationOf(const Decl *): Assertion `isa<LabelDecl>(D) && "declaration not instantiated in this scope"' failed.
|
|
// In release build compilation error on the line below inside lambda:
|
|
// error: variable 'result' is uninitialized when used here [-Werror,-Wuninitialized]
|
|
ExpectedHelper::then_(Expected<bool, int>(), [&](bool) { return result; });
|
|
return {};
|
|
}
|
|
|
|
} // namespace folly
|
|
|
|
inline void bar() {
|
|
folly::tryTo<int>();
|
|
}
|
|
// expected-no-diagnostics
|
|
|
|
//--- folly-conv.h
|
|
#pragma once
|
|
#include "Conv.h"
|
|
// expected-no-diagnostics
|
|
|
|
//--- thrift_cpp2_base.h
|
|
#pragma once
|
|
#include "Conv.h"
|
|
// expected-no-diagnostics
|
|
|
|
//--- logger_base.h
|
|
#pragma once
|
|
import "folly-conv.h";
|
|
import "thrift_cpp2_base.h";
|
|
|
|
inline void foo() {
|
|
folly::tryTo<unsigned>();
|
|
}
|
|
// expected-no-diagnostics
|