Skip to content

Commit 96a5c46

Browse files
[misc] Fix cannot name an alias template, fixes #8683
Issue: #8683 ### Brief Summary Compile error, on mac M4 Sequoia: ``` FAILED: taichi/util/CMakeFiles/taichi_util.dir/image_buffer.cpp.o /Users/hugh/.cache/ti-build-cache/sccache-v041/bin/sccache /usr/bin/clang++ -I/Users/hugh/.cache/ti-build-cache/mambaforge/envs/3.10/lib/python3.10/site-packages/numpy/_core/include -I/Users/hugh/git/taichi -I/Users/hugh/git/taichi/external/include -I/Users/hugh/git/taichi/external/eigen -I/Users/hugh/.cache/ti-build-cache/llvm15-m1-nozstd/include -I/Users/hugh/git/taichi/external/spdlog/include -ffunction-sections -fdata-sections -DTI_ISE_NONE -std=c++17 -fsized-deallocatio n -Wno-deprecated-declarations -Wno-shorten-64-to-32 -Wall -Werror -Wno-ignored-attributes -Wno-nullability-completeness -Wno-unused-private-field -Wno-unneeded-internal-declaration -Wno-unqualified-std-cast-call -Wno-unused-but-set-variable -DTI_ARCH_ARM -DTI_PASS_EXCEPTION_TO_PYTHON -DTI_INCLUDED -fno-objc-arc -DTI_WITH_LLVM -DTI_WITH_METAL -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.4.sdk -mmacosx-version-min=15 .0 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -MD -MT taichi/util/CM akeFiles/taichi_util.dir/image_buffer.cpp.o -MF taichi/util/CMakeFiles/taichi_util.dir/image_buffer.cpp.o.d -o taichi/util/CMakeFiles/taichi_util.dir/image_buffer.cpp.o -c /Users/hugh/git/taichi/taichi/util/image_buffer.cpp /Users/hugh/git/taichi/taichi/util/image_buffer.cpp:21:18: error: a declarative nested name specifier cannot name an alias template [-Werror,-Walias-template-in -declaration-name] 21 | void Array2D<T>::load_image(const std::string &filename, bool linearize) { | ~~~~~~~~~~~~^ /Users/hugh/git/taichi/taichi/util/image_buffer.cpp:60:18: error: a declarative nested name specifier cannot name an alias template [-Werror,-Walias-template-in-declaration-name] 60 | void Array2D<T>::write_as_image(const std::string &filename) { | ~~~~~~~~~~~~^ /Users/hugh/git/taichi/taichi/util/image_buffer.cpp:100:18: error: a declarative nested name specifier cannot name an alias template [-Werror,-Walias-template-in-declaration-name] 100 | void Array2D<T>::write_text(const std::string &font_fn, | ~~~~~~~~~~~~^ 3 errors generated. ``` Fix: - use the NDArray<2, N> directly, instead of the alias copilot:summary ### Walkthrough copilot:walkthrough --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 19672cc commit 96a5c46

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

.github/workflows/scripts/common-utils.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ set -x
55
function unset-git-caching-proxy {
66
echo "Unsetting git caching proxy"
77
# git config --global --list | grep 'url\.' | cut -d'=' -f1 | xargs -L1 git config --global --unset-all || true
8-
git config --global --unset https.proxy
8+
git config --global --unset https.proxy || true
99
}
1010

1111
function set-git-caching-proxy {
1212
trap unset-git-caching-proxy EXIT
1313
echo "Setting git caching proxy"
1414
# git config --global --add url.http://oauth2:[email protected]/.insteadOf https://github.com/
1515
# git config --global --add url.http://oauth2:[email protected]/.insteadOf [email protected]:
16-
git config --global https.proxy http://proxy.tgr:18000
16+
git config --global https.proxy http://proxy.tgr:18000 || true
1717
}
1818

1919
if [ ! -z "$TI_USE_GIT_CACHE" ]; then

taichi/util/image_buffer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
namespace taichi {
1919

2020
template <typename T>
21-
void Array2D<T>::load_image(const std::string &filename, bool linearize) {
21+
void ArrayND<2, T>::load_image(const std::string &filename, bool linearize) {
2222
int channels;
2323
FILE *f = fopen(filename.c_str(), "rb");
2424
TI_ASSERT_INFO(f != nullptr, "Image file not found: " + filename);
@@ -57,7 +57,7 @@ void Array2D<T>::load_image(const std::string &filename, bool linearize) {
5757
}
5858

5959
template <typename T>
60-
void Array2D<T>::write_as_image(const std::string &filename) {
60+
void ArrayND<2, T>::write_as_image(const std::string &filename) {
6161
int comp = 3;
6262
std::vector<unsigned char> data(this->res[0] * this->res[1] * comp);
6363
for (int i = 0; i < this->res[0]; i++) {
@@ -97,12 +97,12 @@ std::map<std::string, stbtt_fontinfo> fonts;
9797
std::map<std::string, std::vector<uint8>> font_buffers;
9898

9999
template <typename T>
100-
void Array2D<T>::write_text(const std::string &font_fn,
101-
const std::string &content_,
102-
real size,
103-
int dx,
104-
int dy,
105-
T color) {
100+
void ArrayND<2, T>::write_text(const std::string &font_fn,
101+
const std::string &content_,
102+
real size,
103+
int dx,
104+
int dy,
105+
T color) {
106106
std::vector<unsigned char> screen_buffer(
107107
(size_t)(this->res[0] * this->res[1]), (unsigned char)0);
108108

0 commit comments

Comments
 (0)