@@ -45,33 +45,32 @@ static std::pair<opentelemetry::nostd::string_view, opentelemetry::common::Attri
4545static std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr3 = {
4646 " accept_third_attr" , 3 };
4747
48- static instrumentation_scope::InstrumentationScope *test_scope_1 =
49- std::move (instrumentation_scope::InstrumentationScope::Create(" test_scope_1" )).get();
50- static instrumentation_scope::InstrumentationScope *test_scope_2 =
51- std::move (instrumentation_scope::InstrumentationScope::Create(" test_scope_2" , " 1.0" )).get();
52- static instrumentation_scope::InstrumentationScope *test_scope_3 =
53- std::move (instrumentation_scope::InstrumentationScope::Create(
54- " test_scope_3" ,
55- " 0" ,
56- " https://opentelemetry.io/schemas/v1.18.0" ))
57- .get();
58- static instrumentation_scope::InstrumentationScope *test_scope_4 =
59- std::move (instrumentation_scope::InstrumentationScope::Create(
60- " test_scope_4" ,
61- " 0" ,
62- " https://opentelemetry.io/schemas/v1.18.0" ,
63- {attr1}))
64- .get();
65- static instrumentation_scope::InstrumentationScope *test_scope_5 =
66- std::move (instrumentation_scope::InstrumentationScope::Create(
67- " test_scope_5" ,
68- " 0" ,
69- " https://opentelemetry.io/schemas/v1.18.0" ,
70- {attr1, attr2, attr3}))
71- .get();
48+ static instrumentation_scope::InstrumentationScope test_scope_1 =
49+ *std::move (instrumentation_scope::InstrumentationScope::Create(" test_scope_1" ));
50+ static instrumentation_scope::InstrumentationScope test_scope_2 =
51+ *std::move (instrumentation_scope::InstrumentationScope::Create(" test_scope_2" , " 1.0" ));
52+ static instrumentation_scope::InstrumentationScope test_scope_3 =
53+ *std::move (instrumentation_scope::InstrumentationScope::Create(
54+ " test_scope_3" ,
55+ " 0" ,
56+ " https://opentelemetry.io/schemas/v1.18.0" ));
57+ static instrumentation_scope::InstrumentationScope test_scope_4 = *std::move (
58+ instrumentation_scope::InstrumentationScope::Create (" test_scope_4" ,
59+ " 0" ,
60+ " https://opentelemetry.io/schemas/v1.18.0" ,
61+ {attr1}));
62+ static instrumentation_scope::InstrumentationScope test_scope_5 = *std::move (
63+ instrumentation_scope::InstrumentationScope::Create (" test_scope_5" ,
64+ " 0" ,
65+ " https://opentelemetry.io/schemas/v1.18.0" ,
66+ {attr1, attr2, attr3}));
7267
68+ // This array could also directly contain the reference types, but that leads to 'uninitialized
69+ // value was created by heap allocation' errors in Valgrind memcheck. This is a bug in Googletest
70+ // library, see https://github.com/google/googletest/issues/3805#issuecomment-1397301790 for more
71+ // details. Using pointers is a workaround to prevent the Valgrind warnings.
7372const std::array<instrumentation_scope::InstrumentationScope *, 5 > instrumentation_scopes = {
74- test_scope_1, test_scope_2, test_scope_3, test_scope_4, test_scope_5,
73+ & test_scope_1, & test_scope_2, & test_scope_3, & test_scope_4, & test_scope_5,
7574};
7675
7776// Test fixture for VerifyDefaultConfiguratorBehavior
0 commit comments