diff options
author | Mark Mitchell <mark@codesourcery.com> | 2003-12-29 02:42:17 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2003-12-29 02:42:17 +0000 |
commit | c11889cef5d45cc5a33fc391ff73980d9f623afb (patch) | |
tree | 03a77065af1da4e7ea52001d708f0111ab58b95d | |
parent | 1896d29d23be825e42ee0c6e8c3afa4c54fbbcaf (diff) | |
download | gcc-c11889cef5d45cc5a33fc391ff73980d9f623afb.zip gcc-c11889cef5d45cc5a33fc391ff73980d9f623afb.tar.gz gcc-c11889cef5d45cc5a33fc391ff73980d9f623afb.tar.bz2 |
re PR c++/13081 (forward template declarations in <complex> let inlining fail)
PR c++/13081
* decl.c (duplicate_decls): Preserve inline-ness when redeclaring
a function template.
PR c++/12613
* decl.c (reshape_init): Reject GNU colon-style designated
initializers in arrays.
PR c++/13081
* g++.dg/opt/inline6.C: New test.
PR c++/12613
* g++.dg/parse/error9.C: New test.
From-SVN: r75192
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/decl.c | 20 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/inline6.C | 14 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/error9.C | 5 |
5 files changed, 52 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3f85d7b..62e395a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,13 @@ 2003-12-28 Mark Mitchell <mark@codesourcery.com> + PR c++/13081 + * decl.c (duplicate_decls): Preserve inline-ness when redeclaring + a function template. + + PR c++/12613 + * decl.c (reshape_init): Reject GNU colon-style designated + initializers in arrays. + PR c++/13009 * call.c (build_special_member_call): Do not assume that we have a pointer to the complete object in an assignment operator. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 0c0803b7..80041cb 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1594,6 +1594,14 @@ duplicate_decls (tree newdecl, tree olddecl) = DECL_SOURCE_LOCATION (newdecl); } + if (DECL_FUNCTION_TEMPLATE_P (newdecl)) + { + DECL_INLINE (DECL_TEMPLATE_RESULT (olddecl)) + |= DECL_INLINE (DECL_TEMPLATE_RESULT (newdecl)); + DECL_DECLARED_INLINE_P (DECL_TEMPLATE_RESULT (olddecl)) + |= DECL_DECLARED_INLINE_P (DECL_TEMPLATE_RESULT (newdecl)); + } + return olddecl; } @@ -4342,7 +4350,17 @@ reshape_init (tree type, tree *initp) TREE_CHAIN (element_init) = CONSTRUCTOR_ELTS (new_init); CONSTRUCTOR_ELTS (new_init) = element_init; if (TREE_PURPOSE (element_init)) - index = TREE_PURPOSE (element_init); + { + tree next_index = TREE_PURPOSE (element_init); + if (TREE_CODE (next_index) == IDENTIFIER_NODE) + { + error ("name `%D' used in a GNU-style designated " + "initializer for an array", next_index); + TREE_PURPOSE (element_init) = NULL_TREE; + } + else + index = next_index; + } } } else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 465b7a9..bfca531 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2003-12-28 Mark Mitchell <mark@codesourcery.com> + PR c++/13081 + * g++.dg/opt/inline6.C: New test. + + PR c++/12613 + * g++.dg/parse/error9.C: New test. + * gcc.dg/const-elim-1.c: XFAIL on arm-*-*. 2003-12-28 Mark Mitchell <mark@codesourcery.com> diff --git a/gcc/testsuite/g++.dg/opt/inline6.C b/gcc/testsuite/g++.dg/opt/inline6.C new file mode 100644 index 0000000..2187221 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/inline6.C @@ -0,0 +1,14 @@ +// PR c++/13081 +// { dg-options "-O2" } +// { dg-final { scan-assembler-not "foo" } } + +template<typename T> T foo(T); + +template<typename T> inline T foo(T t) +{ + return t; +} + +void bar (long& l) { + l = foo(l); +} diff --git a/gcc/testsuite/g++.dg/parse/error9.C b/gcc/testsuite/g++.dg/parse/error9.C new file mode 100644 index 0000000..aa9109f --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error9.C @@ -0,0 +1,5 @@ +// PR c++/12613 +// { dg-options "" } + +enum { FOO = 1, BAR = 2 }; +int a[] = { FOO: 1, BAR: 2 }; // { dg-error "" } |