diff --git a/pycparser/c_generator.py b/pycparser/c_generator.py
index 0575b8b..4c86f84 100644
--- a/pycparser/c_generator.py
+++ b/pycparser/c_generator.py
@@ -283,8 +283,8 @@ class CGenerator(object):
         for name in n.name:
             if isinstance(name, c_ast.ID):
                 s += '.' + name.name
-            elif isinstance(name, c_ast.Constant):
-                s += '[' + name.value + ']'
+            else:
+                s += '[' + self.visit(name) + ']'
         s += ' = ' + self._visit_expr(n.expr)
         return s
 

diff --git a/tests/test_c_generator.py b/tests/test_c_generator.py
index 9385e80..4e38f28 100644
--- a/tests/test_c_generator.py
+++ b/tests/test_c_generator.py
@@ -228,6 +228,11 @@ class TestCtoC(unittest.TestCase):
             }
             ''')
 
+    def test_issue246(self):
+        self._assert_ctoc_correct(r'''
+            int array[3] = {[0] = 0, [1] = 1, [1+1] = 2};
+            ''')
+
     def test_exprlist_with_semi(self):
         self._assert_ctoc_correct(r'''
             void x() {

Constant expressions in designated initializers are not generated back to C
While pycparser correctly parses a constant-expression in a designated initializer (the AST is correct), it fails to write it back when generating C code.

Consider the following code:
```C
void myFunction(void)
{
  int array[3] = {[0] = 0, [1] = 1, [1+1] = 2};
}
```
Parsing it, then using `CGenerator` to generate the source produces:
```C
void myFunction(void)
{
  int array[3] = {[0] = 0, [1] = 1, = 2};
}
```

The C99 grammar describes the designator part of designated initializers as:
```ebnf
designator: [ constant-expression ]
            . identifier
```
(See §6.7.8 in http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf)

The ```CGenerator.visit_NamedInitializer``` currently only considers the `ID` and `Constant` types.
The `Constant` branch should either be extended to other types or be an `else:` branch.
tests/test_c_generator.py::TestCtoC::test_issue246
tests/test_c_generator.py::TestFunctionDeclGeneration::test_partial_funcdecl_generation tests/test_c_generator.py::TestCtoC::test_casts tests/test_c_generator.py::TestCtoC::test_comma_op_assignment tests/test_c_generator.py::TestCtoC::test_comma_op_in_ternary tests/test_c_generator.py::TestCtoC::test_comma_operator_funcarg tests/test_c_generator.py::TestCtoC::test_complex_decls tests/test_c_generator.py::TestCtoC::test_compound_literal tests/test_c_generator.py::TestCtoC::test_enum tests/test_c_generator.py::TestCtoC::test_enum_typedef tests/test_c_generator.py::TestCtoC::test_expr_list_in_initializer_list tests/test_c_generator.py::TestCtoC::test_exprlist_with_semi tests/test_c_generator.py::TestCtoC::test_exprlist_with_subexprlist tests/test_c_generator.py::TestCtoC::test_exprs tests/test_c_generator.py::TestCtoC::test_generate_struct_union_enum_exception tests/test_c_generator.py::TestCtoC::test_initlist tests/test_c_generator.py::TestCtoC::test_issue36 tests/test_c_generator.py::TestCtoC::test_issue37 tests/test_c_generator.py::TestCtoC::test_issue83 tests/test_c_generator.py::TestCtoC::test_issue84 tests/test_c_generator.py::TestCtoC::test_krstyle tests/test_c_generator.py::TestCtoC::test_nest_initializer_list tests/test_c_generator.py::TestCtoC::test_nest_named_initializer tests/test_c_generator.py::TestCtoC::test_pragma tests/test_c_generator.py::TestCtoC::test_statements tests/test_c_generator.py::TestCtoC::test_struct_decl tests/test_c_generator.py::TestCtoC::test_switchcase tests/test_c_generator.py::TestCtoC::test_ternary tests/test_c_generator.py::TestCtoC::test_trivial_decls