Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily suppress dependent name types #329

Merged
merged 9 commits into from
Jun 6, 2020
10 changes: 10 additions & 0 deletions src/visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,16 @@ bool chimera::Visitor::GenerateTypedefName(TypedefNameDecl *decl)
return false;
}

// TODO: Fix segfault with DependentNameType (e.g., typename T::type).
// Skip this for now. See #328 for the details.
if (isa<DependentNameType>(underlying_type))
{
std::cerr << "Warning: Skipping dependent name type '"
<< decl->getQualifiedNameAsString()
<< "' because it is not supported yet (#328)." << std::endl;
return false;
}

// Create mstch for typedef where the underlying type is a builtin type.
if (isa<BuiltinType>(underlying_type))
{
Expand Down
1 change: 1 addition & 0 deletions test/examples/regression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ add_subdirectory(issue228_template_type_alias)
add_subdirectory(issue262_static_method)
add_subdirectory(issue297_template_variable)
add_subdirectory(issue310_nested_class_name)
add_subdirectory(issue328_dependent_name)
17 changes: 17 additions & 0 deletions test/examples/regression/issue328_dependent_name/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
set(test_name "issue328_dependent_name")

chimera_add_binding_test_pybind11(${test_name}_pybind11
SOURCES ${test_name}.h
NAMESPACES chimera_test
CONFIGURATION ${CMAKE_CURRENT_SOURCE_DIR}/pybind11.yaml
COPY_MODULE
)

chimera_add_binding_test_boost_python(${test_name}_boost_python
SOURCES ${test_name}.h
NAMESPACES chimera_test
CONFIGURATION ${CMAKE_CURRENT_SOURCE_DIR}/boost_python.yaml
COPY_MODULE
)

chimera_add_python_test(${test_name}_python_tests ${test_name}.py)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Arguments that will be appended in-order before command line arguments.
arguments:
- "-extra-arg"
- "-I/usr/lib/clang/3.6/include"
namespaces:
"chimera_test":
name: null # TODO: otherwise, import error
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once

#include <type_traits>

namespace chimera_test
{

template <typename T>
class Vector
{
public:
using Scalar = T;

Vector() = default;
};

template <typename S>
struct ScalarTrait
{
typedef typename S::Scalar type;
};

using VectorScalar = ScalarTrait<Vector<double>>::type;

} // namespace chimera_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import unittest

import issue328_dependent_name_pybind11 as py11
import issue328_dependent_name_boost_python as boost


class TestIssue328(unittest.TestCase):

def _test_issue328(self, binding):
# TODO: The next line should be uncommented once #328 is resolved.
# self.assertEqual(binding.VectorScalar, float)
pass

def test_issue328(self):
self._test_issue328(py11)
self._test_issue328(boost)
Copy link
Member

@psigen psigen May 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In situations where we are just suppressing an issue instead of solving it, could we add an assertion that should work if we didn't have the error (like being able to access this ::type) and then comment it out in the test?

I am worried it will be hard to tell which issues we have solved and which ones we have just covered up. This makes it hard if we e.g. upgrade clang: some of this functionality might get fixed, but we won't know how to test if it is without reading many old bug reports.



if __name__ == '__main__':
unittest.main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Arguments that will be appended in-order before command line arguments.
arguments:
- "-extra-arg"
- "-I/usr/lib/clang/3.6/include"
namespaces:
"chimera_test":
name: null # TODO: otherwise, import error