Closed Stefan-Dienst closed 2 years ago
Hey Stefan,
Can you give a complete minimal example?
Hey Nils,
sorry that it took me so long to answer.
While formulating a complete minimal example, I noticed that i described the problem improper. The above described error is only thrown if a structured binding declaration is used in combination with openmp.
So for example, using the following file in tprf:
#include "../types.hpp"
#include <omp.h>
namespace triqs_tprf {
g_wk_t test(g_wk_vt g_wk) {
auto [wmesh, kmesh] = g_wk.mesh();
#pragma omp parallel for
for(unsigned int idx = 0; idx < kmesh.size(); idx++) {}
return g_wk;
}}
throws the error reference to local binding 'kmesh' declared in enclosing function 'triqs_tprf::test' for(unsigned int idx = 0; idx < kmesh.size(); idx++) {}
While
#include "../types.hpp"
#include <omp.h>
namespace triqs_tprf {
g_wk_t test(g_wk_vt g_wk) {
auto wmesh = std::get<0>(g_wk.mesh());
auto kmesh = std::get<1>(g_wk.mesh());
#pragma omp parallel for
for(unsigned int idx = 0; idx < kmesh.size(); idx++) {}
return g_wk;
}}
and
#include "../types.hpp"
#include <omp.h>
namespace triqs_tprf {
g_wk_t test(g_wk_vt g_wk) {
auto [wmesh, kmesh] = g_wk.mesh();
for(unsigned int idx = 0; idx < kmesh.size(); idx++) {}
return g_wk;
}}
work fine.
Hi Stefan,
Have you tried if this problem persists with the most recent clang-9 compiler?
Can you convert the example into one that is ready to compile?
We do not have your types.hpp
Hi Nils,
I have setup a app4triqs triqs repo only containing this problem here https://github.com/StefanKaeser/tests_for_triqs/tree/structured_binding.
Compiling this with clang 8.0 gives me the following error.
/home/kaeser/my_triqs_installations/tests_for_triqs.src/c++/tests_for_triqs/tests_for_triqs.cpp:14:35: error:
reference to local binding 'kmesh' declared in enclosing function
'tests_for_triqs::test'
for(unsigned int idx = 0; idx < kmesh.size(); idx++) {}
^
/home/kaeser/my_triqs_installations/tests_for_triqs.src/c++/tests_for_triqs/tests_for_triqs.cpp:11:16: note:
'kmesh' declared here
auto [wmesh, kmesh] = g_wk.mesh();
^
1 error generated.
I have no yet tried clang-9, but will do.
This issue is resolved by recent versions of clang. Reopen if needed.
Dear all,
I have recently upgraded to clang 8.0 which resulted in an error when compiling tprf. The error occurs when I use a structured binding declaration for the MeshProduct and use the result in the
make_gf
function, e.g.The error message reads:
reference to local binding 'rmesh' declared in enclosing function
.Does anyone know why this results in an error? I could compile without any problems with clang 6.0.
Cheers Stefan