Skip to content

Commit 1478474

Browse files
committed
Fix builds with gcc 10.1 libstdc++ builds (VectorSubscriptBox error)
Fixes #1157. The std::variant implementation of some libstdc++ cause clang to try constructing a LoweredVectorSubscript from a LoweredTriplet, causing crash. This was possible because the compiler thought it could build and fir::ExtendedValue to build a LoweredVectorSubscript (because fir::ExtendedValue has a template constructor where the template can match anything.). Prevent the compiler from attempting to build a LoweredVectorSubscript here by adding a constructor to LowereVectorSubscript.
1 parent 0e99705 commit 1478474

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

flang/include/flang/Lower/VectorSubscripts.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class VectorSubscriptBox {
6161
using ElementalGeneratorWithBoolReturn =
6262
std::function<mlir::Value(const fir::ExtendedValue &)>;
6363
struct LoweredVectorSubscript {
64+
LoweredVectorSubscript(fir::ExtendedValue &&vector, mlir::Value size)
65+
: vector{std::move(vector)}, size{size} {}
6466
fir::ExtendedValue vector;
6567
// Vector size, guaranteed to be of indexType.
6668
mlir::Value size;

0 commit comments

Comments
 (0)