aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-04-19 20:06:19 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-04-19 20:06:19 -0400
commitc45413fef61b8c6873f01e1e2f57cd0be6fcec46 (patch)
tree824a882a9918314f543413bb9d1acf74b7602879 /gcc
parent8f888468542a71fd6324f2e6668e7f968000f641 (diff)
downloadgcc-c45413fef61b8c6873f01e1e2f57cd0be6fcec46.zip
gcc-c45413fef61b8c6873f01e1e2f57cd0be6fcec46.tar.gz
gcc-c45413fef61b8c6873f01e1e2f57cd0be6fcec46.tar.bz2
re PR c++/45267 (inlining fails with -m32)
PR c++/45267 * decl.c (duplicate_decls): Keep always_inline attribute in sync with DECL_DISREGARD_INLINE_LIMITS. From-SVN: r172744
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c13
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib41.C19
4 files changed, 42 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ec683a2..7feb427 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2011-04-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/45267
+ * decl.c (duplicate_decls): Keep always_inline attribute
+ in sync with DECL_DISREGARD_INLINE_LIMITS.
+
2011-04-18 Jason Merrill <jason@redhat.com>
PR c++/48569
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 794832b..6309648 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2052,6 +2052,19 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* [temp.expl.spec/14] We don't inline explicit specialization
just because the primary template says so. */
+
+ /* But still keep DECL_DISREGARD_INLINE_LIMITS in sync with
+ the always_inline attribute. */
+ if (DECL_DISREGARD_INLINE_LIMITS (olddecl)
+ && !DECL_DISREGARD_INLINE_LIMITS (newdecl))
+ {
+ if (DECL_DECLARED_INLINE_P (newdecl))
+ DECL_DISREGARD_INLINE_LIMITS (newdecl) = true;
+ else
+ DECL_ATTRIBUTES (newdecl)
+ = remove_attribute ("always_inline",
+ DECL_ATTRIBUTES (newdecl));
+ }
}
else if (new_defines_function && DECL_INITIAL (olddecl))
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b6de528..7e5d187 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-19 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/ext/attrib41.C: New.
+
2011-04-19 Kaz Kojima <kkojima@gcc.gnu.org>
PR testsuite/48676
diff --git a/gcc/testsuite/g++.dg/ext/attrib41.C b/gcc/testsuite/g++.dg/ext/attrib41.C
new file mode 100644
index 0000000..368554a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib41.C
@@ -0,0 +1,19 @@
+// PR c++/45267
+// { dg-options "-O" }
+
+template<typename T> struct Vector {
+ Vector(long long x);
+ inline Vector<T> operator<<(int x) const __attribute__((always_inline));
+};
+long long bar (long long);
+template<> inline Vector<int> Vector<int>::operator<<(int x) const {
+ return bar(x);
+}
+bool b;
+int main() {
+ Vector<int> a(1);
+ if ((a << 2), b) {
+ a << 2;
+ throw 1;
+ }
+}