+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
/* [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))
{
--- /dev/null
+// 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;
+ }
+}