Skip to content

Commit 416d443

Browse files
markfinallgritz
authored andcommitted
Fixes compiler error (AppleClang,Gcc) in using std::atomic values as printf arguments (#826)
Compiler error in AppleClang (Xcode8) is /Users/mark/dev/Thirdparty/OSL-1.9/src/liboslcomp/ast.cpp:76:33: error: call to implicitly-deleted copy constructor of 'std::atomic<int>' i, node_counts[i], node_counts_peak[i]); ^~~~~~~~~~~~~~ Compiler error in Gcc (4.8) is /home/mark/dev/Thirdparty/OSL-1.9/src/liboslcomp/ast.cpp:76:68: error: use of deleted function ‘std::atomic<int>::atomic(const std::atomic<int>&)’ i, node_counts[i], node_counts_peak[i]); ^ Believe this is a problem because printf accepts arguments by value, whereas OIIO 1.8's Strutil::printf takes by reference, and you can't copy a std::atomic.
1 parent 848aa8e commit 416d443

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/liboslcomp/ast.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ ScopeExit print_node_counts ([](){
7373
i, node_counts[i], node_counts_peak[i]);
7474
#else
7575
printf("ASTNode type %2d: %5d (peak %5d)\n",
76-
i, node_counts[i], node_counts_peak[i]);
76+
i, node_counts[i].load(), node_counts_peak[i].load());
7777
#endif
7878
});
7979
}

0 commit comments

Comments
 (0)