You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2007/03/09 01:56:24 UTC

[jira] Created: (STDCXX-351) [gcc 3.4.6] error on static const int expression as an array dimension in template code

[gcc 3.4.6] error on static const int expression as an array dimension in template code
---------------------------------------------------------------------------------------

                 Key: STDCXX-351
                 URL: https://issues.apache.org/jira/browse/STDCXX-351
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
         Environment: gcc 3.4.6
            Reporter: Martin Sebor


The well-formed program below fails to compile with gcc 3.4.6 (gcc 4.1 does fine):

$ cat t.cpp && gcc --version && gcc -pedantic t.cpp
template <class> struct S { static const int N = 1; };

template <class>
void foo () {
    static const int N = S<int>::N;
    static int a [S<int>::N];
    static int b [N];
}

int main () { foo<int>(); }

gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

t.cpp: In function `void foo()':
t.cpp:7: error: ISO C++ forbids variable-size array `b'


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-351) [gcc 3.4.6] error on static const int expression as an array dimension in template code

Posted by "Mark Brown (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483012 ] 

Mark Brown commented on STDCXX-351:
-----------------------------------

The test compiles now so your change must have fixed it.

> [gcc 3.4.6] error on static const int expression as an array dimension in template code
> ---------------------------------------------------------------------------------------
>
>                 Key: STDCXX-351
>                 URL: https://issues.apache.org/jira/browse/STDCXX-351
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: External
>         Environment: gcc 3.4.6
>            Reporter: Martin Sebor
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The well-formed program below fails to compile with gcc 3.4.6 (gcc 4.1 does fine):
> $ cat t.cpp && gcc --version && gcc -pedantic t.cpp
> template <class> struct S { static const int N = 1; };
> template <class>
> void foo () {
>     static const int N = S<int>::N;
>     static int a [S<int>::N];
>     static int b [N];
> }
> int main () { foo<int>(); }
> gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
> Copyright (C) 2006 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> t.cpp: In function `void foo()':
> t.cpp:7: error: ISO C++ forbids variable-size array `b'

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (STDCXX-351) [gcc 3.4.6] error on static const int expression as an array dimension in template code

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor closed STDCXX-351.
-------------------------------


Rats, this is a compiler bug, not a bug in the test as I thought. Oh well, it's also fixed in later versions of gcc, so I'll go ahead and close it.

> [gcc 3.4.6] error on static const int expression as an array dimension in template code
> ---------------------------------------------------------------------------------------
>
>                 Key: STDCXX-351
>                 URL: https://issues.apache.org/jira/browse/STDCXX-351
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: External
>         Environment: gcc 3.4.6
>            Reporter: Martin Sebor
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The well-formed program below fails to compile with gcc 3.4.6 (gcc 4.1 does fine):
> $ cat t.cpp && gcc --version && gcc -pedantic t.cpp
> template <class> struct S { static const int N = 1; };
> template <class>
> void foo () {
>     static const int N = S<int>::N;
>     static int a [S<int>::N];
>     static int b [N];
> }
> int main () { foo<int>(); }
> gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
> Copyright (C) 2006 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> t.cpp: In function `void foo()':
> t.cpp:7: error: ISO C++ forbids variable-size array `b'

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (STDCXX-351) [gcc 3.4.6] error on static const int expression as an array dimension in template code

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor resolved STDCXX-351.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 4.2

I'll set the status of this to Resolved/Fixed. If I don't hear back I'll close it.

> [gcc 3.4.6] error on static const int expression as an array dimension in template code
> ---------------------------------------------------------------------------------------
>
>                 Key: STDCXX-351
>                 URL: https://issues.apache.org/jira/browse/STDCXX-351
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: External
>         Environment: gcc 3.4.6
>            Reporter: Martin Sebor
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The well-formed program below fails to compile with gcc 3.4.6 (gcc 4.1 does fine):
> $ cat t.cpp && gcc --version && gcc -pedantic t.cpp
> template <class> struct S { static const int N = 1; };
> template <class>
> void foo () {
>     static const int N = S<int>::N;
>     static int a [S<int>::N];
>     static int b [N];
> }
> int main () { foo<int>(); }
> gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
> Copyright (C) 2006 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> t.cpp: In function `void foo()':
> t.cpp:7: error: ISO C++ forbids variable-size array `b'

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (STDCXX-351) [gcc 3.4.6] error on static const int expression as an array dimension in template code

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor reassigned STDCXX-351:
-----------------------------------

    Assignee: Martin Sebor

> [gcc 3.4.6] error on static const int expression as an array dimension in template code
> ---------------------------------------------------------------------------------------
>
>                 Key: STDCXX-351
>                 URL: https://issues.apache.org/jira/browse/STDCXX-351
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: External
>         Environment: gcc 3.4.6
>            Reporter: Martin Sebor
>         Assigned To: Martin Sebor
>
> The well-formed program below fails to compile with gcc 3.4.6 (gcc 4.1 does fine):
> $ cat t.cpp && gcc --version && gcc -pedantic t.cpp
> template <class> struct S { static const int N = 1; };
> template <class>
> void foo () {
>     static const int N = S<int>::N;
>     static int a [S<int>::N];
>     static int b [N];
> }
> int main () { foo<int>(); }
> gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
> Copyright (C) 2006 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> t.cpp: In function `void foo()':
> t.cpp:7: error: ISO C++ forbids variable-size array `b'

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.