diff options
author | synergydev <synergye@codefi.re> | 2013-10-17 18:16:42 -0700 |
---|---|---|
committer | synergydev <synergye@codefi.re> | 2013-10-17 18:16:42 -0700 |
commit | 61c0330cc243abf13fdd01f377a7f80bd3989eb1 (patch) | |
tree | 119b08ae76294f23e2b1b7e72ff9a06afa9e8509 /gcc-4.8/gcc/testsuite/g++.dg | |
parent | 1c712bf7621f3859c33fd3afaa61fdcaf3fdfd76 (diff) | |
download | toolchain_gcc-61c0330cc243abf13fdd01f377a7f80bd3989eb1.tar.gz toolchain_gcc-61c0330cc243abf13fdd01f377a7f80bd3989eb1.tar.bz2 toolchain_gcc-61c0330cc243abf13fdd01f377a7f80bd3989eb1.zip |
[4.8] Merge GCC 4.8.2
Change-Id: I0f1fcf69c5076d8534c5c45562745e1a37adb197
Diffstat (limited to 'gcc-4.8/gcc/testsuite/g++.dg')
29 files changed, 1086 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/constexpr-value4.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/constexpr-value4.C new file mode 100644 index 000000000..1fc373855 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/constexpr-value4.C @@ -0,0 +1,16 @@ +// PR c++/57901 +// { dg-require-effective-target c++11 } + +struct Z { + Z() = default; + Z(Z const&) = default; + constexpr Z(Z&&) {} /* non-trivial (constexpr) move ctor */ +}; + +template<typename T> +constexpr int fn0(T v) { return 0; } +template<typename T> +constexpr int fn (T v) { return fn0(v); } + +constexpr auto t0 = fn0(Z()); // OK! +constexpr auto t = fn (Z()); // error! (GCC 4.8.1) diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/decltype55.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/decltype55.C new file mode 100644 index 000000000..95427fc00 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/decltype55.C @@ -0,0 +1,20 @@ +// PR c++/53211 +// { dg-do compile { target c++11 } } + +template<typename A, typename B> + struct is_same { static const bool value = false; }; + +template<typename A> + struct is_same<A, A> { static const bool value = true; }; + +template<typename... Args> +void func(Args... args) +{ + int arr[] = { args... }; + static_assert (is_same<decltype(arr), int[sizeof...(Args)]>::value, ""); +} + +int main() +{ + func(1, 2, 3, 4); +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/defaulted44.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/defaulted44.C new file mode 100644 index 000000000..213c1393e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/defaulted44.C @@ -0,0 +1,24 @@ +// PR c++/57319 +// { dg-require-effective-target c++11 } + +namespace N1 { + struct A { }; + struct B: virtual A { }; + struct C: virtual B { }; + + struct D: C + { + void operator= (D &); + }; +} + +namespace N2 { + struct A { A& operator=(A&&); }; + struct B: virtual A { }; // { dg-warning "move assignment" } + struct C: virtual B { }; // { dg-warning "move assignment" } + + struct D: C + { + void operator= (D &); + }; +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/defaulted45.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/defaulted45.C new file mode 100644 index 000000000..e91b3a182 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/defaulted45.C @@ -0,0 +1,20 @@ +// { dg-do run } +// { dg-require-effective-target c++11 } + +struct A +{ + int i; + A() = default; + A(int i): i{i} { } + ~A() {} +}; + +int main(int argc, char **argv) +{ + { int i[4] = { 42, 42, 42, 42 }; } + { + A a[4] = { argc }; + if (a[1].i != 0) + __builtin_abort (); + } +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/initlist71.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/initlist71.C new file mode 100644 index 000000000..7aeeb2947 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/initlist71.C @@ -0,0 +1,9 @@ +// PR c++/56930 +// { dg-require-effective-target c++11 } +// { dg-options -Wconversion } + +int main() +{ + int x = sizeof(int); + int y { sizeof(int) }; +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-auto3.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-auto3.C new file mode 100644 index 000000000..013ed5264 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-auto3.C @@ -0,0 +1,24 @@ +// PR c++/57526 +// { dg-require-effective-target c++11 } + +template<class T> +struct A +{ + void bar( ) { } + + void foo( ) + { + auto* this_ptr = this; + auto lc = [&]( ) + { + this_ptr->bar(); + }; + lc(); + } +}; + +int main() +{ + A<int> a; + a.foo(); +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C new file mode 100644 index 000000000..d85918dd0 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C @@ -0,0 +1,30 @@ +// PR c++/58083 +// { dg-do compile { target c++11 } } + +namespace details { +struct iterator_concept_checker +{ + typedef char yes_type; + typedef char (&no_type)[2]; + + template <typename T> + static no_type test(...); + + template <typename T> + static yes_type test( + int* + , void (*)(T) = [](T it) + { + auto copy = T{it}; // copy constructible + copy = it; // copy assignable + copy.~T(); // destroyable + ++it; // incrementable + } + ); +}; +} + +int main() +{ + details::iterator_concept_checker::test<int>(0); +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice10.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice10.C new file mode 100644 index 000000000..1ea59c21c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice10.C @@ -0,0 +1,8 @@ +// PR c++/58568 +// { dg-do compile { target c++11 } } + +template<int> struct A +{ + static const int i; + template<int N> const int A<N>::i = []{ return 0; }(); // { dg-error "invalid use" } +}; diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-return1.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-return1.C new file mode 100644 index 000000000..4b353b64c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-return1.C @@ -0,0 +1,26 @@ +// PR c++/57437 +// { dg-require-effective-target c++11 } + +struct A { + int i; + + A(): i(42) {} + A(const A&) = default; + A(A&& a): i(a.i) { a.i = 0; } +}; + +int main() +{ + A x; + + auto y = [x] () mutable { + x.i++; + return x; + }; + + if (y().i != 43) + __builtin_abort (); + + if (y().i != 44) + __builtin_abort (); +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/noexcept21.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/noexcept21.C new file mode 100644 index 000000000..ec88e1d3d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/noexcept21.C @@ -0,0 +1,87 @@ +// PR c++/57645 +// { dg-do compile { target c++11 } } + +struct Thrower +{ + ~Thrower() noexcept(false) { throw 1; } +}; + +struct ExplicitA +{ + ~ExplicitA() {} + + Thrower t; +}; + +struct ExplicitB +{ + ~ExplicitB(); + + Thrower t; +}; + +ExplicitB::~ExplicitB() {} + +struct ExplicitC +{ + ~ExplicitC() = default; + + Thrower t; +}; + +struct ExplicitD +{ + ~ExplicitD(); + + Thrower t; +}; + +ExplicitD::~ExplicitD() = default; + +struct NoThrower +{ + ~NoThrower() noexcept(true) {} +}; + +struct ExplicitE +{ + ~ExplicitE() {} + + NoThrower t; +}; + +struct ExplicitF +{ + ~ExplicitF(); + + NoThrower t; +}; + +ExplicitF::~ExplicitF() {} + +struct ExplicitG +{ + ~ExplicitG() = default; + + NoThrower t; +}; + +struct ExplicitH +{ + ~ExplicitH(); + + NoThrower t; +}; + +ExplicitH::~ExplicitH() = default; + +#define SA(X) static_assert(X, #X) + +SA( !noexcept(ExplicitA()) ); +SA( !noexcept(ExplicitB()) ); +SA( !noexcept(ExplicitC()) ); +SA( !noexcept(ExplicitD()) ); +SA( noexcept(ExplicitE()) ); +SA( noexcept(ExplicitF()) ); +SA( noexcept(ExplicitG()) ); +SA( noexcept(ExplicitH()) ); diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/pr57981.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/pr57981.C new file mode 100644 index 000000000..5ee1f0ed6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/pr57981.C @@ -0,0 +1,17 @@ +// { dg-options "-std=c++11 -Wall -Wextra" } + +template<class T> +void f(T t, void* = 0) // { dg-warning "unused parameter" } +{ +} + +template<class T> +auto g(T t) -> decltype(f(t)) +{ + f(t); +} + +int main() +{ + g(0); +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/ref-qual14.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/ref-qual14.C new file mode 100644 index 000000000..8e55551ae --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/ref-qual14.C @@ -0,0 +1,18 @@ +// PR c++/57825 +// { dg-do compile { target c++11 } } + +template<typename T> +struct target_class +{}; + +template<typename Class, typename Ret, typename... Args> +struct target_class<Ret (Class::*)(Args...)> +{}; + +template<typename Class, typename Ret, typename... Args> +struct target_class<Ret (Class::*)(Args...) &> +{}; + +template<typename Class, typename Ret, typename... Args> +struct target_class<Ret (Class::*)(Args...) &&> +{}; diff --git a/gcc-4.8/gcc/testsuite/g++.dg/debug/template2.C b/gcc-4.8/gcc/testsuite/g++.dg/debug/template2.C new file mode 100644 index 000000000..9f5bcd9b1 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/debug/template2.C @@ -0,0 +1,14 @@ +// PR c++/57545 + +template<typename T, long unsigned int N> +struct array { + T data[N]; +}; + +template<typename T> +struct derived { + typedef long unsigned int size_type; + static const size_type n = 42; + + array<int, n> a; +}; diff --git a/gcc-4.8/gcc/testsuite/g++.dg/expr/const1.C b/gcc-4.8/gcc/testsuite/g++.dg/expr/const1.C new file mode 100644 index 000000000..8c1271d5c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/expr/const1.C @@ -0,0 +1,9 @@ +// PR c++/57551 + +extern unsigned long ADDR; + +unsigned long f(){ + const unsigned long* const var=&ADDR; + const unsigned long retval=var[1]; + return retval; +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/ext/pr57362.C b/gcc-4.8/gcc/testsuite/g++.dg/ext/pr57362.C new file mode 100644 index 000000000..67f96857e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/ext/pr57362.C @@ -0,0 +1,199 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-require-ifunc "" } */ + +__attribute__((target("default"))) +int foo(void) { return 1; } +__attribute__((target("128bit-long-double"))) +int foo(void) { return 1; } +__attribute__((target("80387"))) +int foo(void) { return 1; } +__attribute__((target("96bit-long-double"))) +int foo(void) { return 1; } +__attribute__((target("long-double-80"))) +int foo(void) { return 1; } +__attribute__((target("long-double-64"))) +int foo(void) { return 1; } +__attribute__((target("accumulate-outgoing-args"))) +int foo(void) { return 1; } +__attribute__((target("align-double"))) +int foo(void) { return 1; } +__attribute__((target("align-stringops"))) +int foo(void) { return 1; } +__attribute__((target("fancy-math-387"))) +int foo(void) { return 1; } +__attribute__((target("force-drap"))) +int foo(void) { return 1; } +__attribute__((target("fp-ret-in-387"))) +int foo(void) { return 1; } +__attribute__((target("hard-float"))) +int foo(void) { return 1; } +__attribute__((target("ieee-fp"))) +int foo(void) { return 1; } +__attribute__((target("inline-all-stringops"))) +int foo(void) { return 1; } +__attribute__((target("inline-stringops-dynamically"))) +int foo(void) { return 1; } +__attribute__((target("intel-syntax"))) +int foo(void) { return 1; } +__attribute__((target("ms-bitfields"))) +int foo(void) { return 1; } +__attribute__((target("no-align-stringops"))) +int foo(void) { return 1; } +__attribute__((target("no-fancy-math-387"))) +int foo(void) { return 1; } +__attribute__((target("no-push-args"))) +int foo(void) { return 1; } +__attribute__((target("no-red-zone"))) +int foo(void) { return 1; } +__attribute__((target("omit-leaf-frame-pointer"))) +int foo(void) { return 1; } +__attribute__((target("pc32"))) +int foo(void) { return 1; } +__attribute__((target("pc64"))) +int foo(void) { return 1; } +__attribute__((target("pc80"))) +int foo(void) { return 1; } +__attribute__((target("push-args"))) +int foo(void) { return 1; } +__attribute__((target("red-zone"))) +int foo(void) { return 1; } +__attribute__((target("rtd"))) +int foo(void) { return 1; } +__attribute__((target("soft-float"))) +int foo(void) { return 1; } +__attribute__((target("sseregparm"))) +int foo(void) { return 1; } +__attribute__((target("stackrealign"))) +int foo(void) { return 1; } +__attribute__((target("stack-arg-probe"))) +int foo(void) { return 1; } +__attribute__((target("tls-direct-seg-refs"))) +int foo(void) { return 1; } +__attribute__((target("vect8-ret-in-mem"))) +int foo(void) { return 1; } +__attribute__((target("recip"))) +int foo(void) { return 1; } +__attribute__((target("cld"))) +int foo(void) { return 1; } +__attribute__((target("vzeroupper"))) +int foo(void) { return 1; } +__attribute__((target("dispatch-scheduler"))) +int foo(void) { return 1; } +__attribute__((target("prefer-avx128"))) +int foo(void) { return 1; } +__attribute__((target("32"))) +int foo(void) { return 1; } +__attribute__((target("64"))) +int foo(void) { return 1; } +__attribute__((target("x32"))) +int foo(void) { return 1; } +__attribute__((target("mmx"))) +int foo(void) { return 1; } +__attribute__((target("3dnow"))) +int foo(void) { return 1; } +__attribute__((target("3dnowa"))) +int foo(void) { return 1; } +__attribute__((target("sse"))) +int foo(void) { return 1; } +__attribute__((target("sse2"))) +int foo(void) { return 1; } +__attribute__((target("sse3"))) +int foo(void) { return 1; } +__attribute__((target("ssse3"))) +int foo(void) { return 1; } +__attribute__((target("sse4.1"))) +int foo(void) { return 1; } +__attribute__((target("sse4.2"))) +int foo(void) { return 1; } +__attribute__((target("sse4"))) +int foo(void) { return 1; } +__attribute__((target("no-sse4"))) +int foo(void) { return 1; } +__attribute__((target("sse5"))) +int foo(void) { return 1; } +__attribute__((target("avx"))) +int foo(void) { return 1; } +__attribute__((target("avx2"))) +int foo(void) { return 1; } +__attribute__((target("fma"))) +int foo(void) { return 1; } +__attribute__((target("sse4a"))) +int foo(void) { return 1; } +__attribute__((target("fma4"))) +int foo(void) { return 1; } +__attribute__((target("xop"))) +int foo(void) { return 1; } +__attribute__((target("lwp"))) +int foo(void) { return 1; } +__attribute__((target("abm"))) +int foo(void) { return 1; } +__attribute__((target("popcnt"))) +int foo(void) { return 1; } +__attribute__((target("bmi"))) +int foo(void) { return 1; } +__attribute__((target("bmi2"))) +int foo(void) { return 1; } +__attribute__((target("lzcnt"))) +int foo(void) { return 1; } +__attribute__((target("hle"))) +int foo(void) { return 1; } +__attribute__((target("rdseed"))) +int foo(void) { return 1; } +__attribute__((target("prfchw"))) +int foo(void) { return 1; } +__attribute__((target("adx"))) +int foo(void) { return 1; } +__attribute__((target("fxsr"))) +int foo(void) { return 1; } +__attribute__((target("xsave"))) +int foo(void) { return 1; } +__attribute__((target("xsaveopt"))) +int foo(void) { return 1; } +__attribute__((target("tbm"))) +int foo(void) { return 1; } +__attribute__((target("cx16"))) +int foo(void) { return 1; } +__attribute__((target("sahf"))) +int foo(void) { return 1; } +__attribute__((target("movbe"))) +int foo(void) { return 1; } +__attribute__((target("crc32"))) +int foo(void) { return 1; } +__attribute__((target("aes"))) +int foo(void) { return 1; } +__attribute__((target("pclmul"))) +int foo(void) { return 1; } +__attribute__((target("sse2avx"))) +int foo(void) { return 1; } +__attribute__((target("fsgsbase"))) +int foo(void) { return 1; } +__attribute__((target("rdrnd"))) +int foo(void) { return 1; } +__attribute__((target("f16c"))) +int foo(void) { return 1; } +__attribute__((target("fentry"))) +int foo(void) { return 1; } +__attribute__((target("8bit-idiv"))) +int foo(void) { return 1; } +__attribute__((target("avx256-split-unaligned-load"))) +int foo(void) { return 1; } +__attribute__((target("avx256-split-unaligned-store"))) +int foo(void) { return 1; } +__attribute__((target("rtm"))) +int foo(void) { return 1; } +//--------------- + +#include <stdio.h> + int main (void) + { + int result; + result = foo(); + printf("Result is %d\n", result); + return result; + } + +/* { dg-prune-output "attribute.* is unknown" } */ +/* { dg-prune-output "redefinition of int foo" } */ +/* { dg-prune-output "previous declaration of int foo" } */ +/* { dg-prune-output "int foo.* previously defined here" } */ +/* { dg-prune-output "No dispatcher found for" } */ diff --git a/gcc-4.8/gcc/testsuite/g++.dg/ext/pr57735.C b/gcc-4.8/gcc/testsuite/g++.dg/ext/pr57735.C new file mode 100644 index 000000000..0eb95006d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/ext/pr57735.C @@ -0,0 +1,145 @@ +/* { dg-do compile { target arm*-*-* } } */ +/* { dg-options "-march=armv5te -marm -mtune=xscale -mfloat-abi=soft -O1" } */ + +typedef unsigned int size_t; +__extension__ +typedef long long int int64_t; +namespace WTF { + template<typename T> class RefPtr { + public: + inline T* operator->() const { return m_ptr; } + T* m_ptr; + }; +} +using WTF::RefPtr; +namespace JSC { + class ExecState; + class JSString; + typedef int64_t EncodedJSValue; + class JSValue { + public: + static EncodedJSValue encode(JSValue); + JSString* toString(ExecState*) const; + }; +} +typedef unsigned char LChar; + typedef short unsigned int UChar; +namespace WTF { + template<typename T, size_t inlineCapacity = 0> + class Vector { + public: + template<typename U> bool tryAppend(const U*, size_t); + }; +} +using WTF::Vector; +namespace WTF { +template<typename CharType> inline bool isASCIIDigit(CharType c) +{ +} +template<typename CharType> inline bool isASCIIHexDigit(CharType c) +{ + return isASCIIDigit(c) || ((c | 0x20) >= 'a' && (c | 0x20) <= 'f'); +} + class StringImpl; +} +using WTF::StringImpl; +namespace WTF { +class StringImpl { +public: + unsigned length() const { return m_length; } + unsigned m_length; +}; +} +namespace JSC { + class Register { + }; +class UString { +public: + unsigned length() const + { + return m_impl->length(); + } + const LChar* characters8() const + { + } + RefPtr<StringImpl> m_impl; +}; + class ExecState : private Register { + public: + JSValue argument(size_t argument) + { + } + }; + class JSCell { + }; + class JSString : public JSCell { + public: + const UString& value(ExecState*) const; + }; +class JSStringBuilder { +public: + void append(const UChar u) + { + m_okay &= buffer16.tryAppend(&u, 1); + } + Vector<UChar, 64> buffer16; + bool m_okay; +}; +template <typename T> +class Lexer { +public: + static unsigned char convertHex(int c1, int c2); +}; +} +namespace WTF { +namespace Unicode { + int UTF8SequenceLength(char); + int decodeUTF8Sequence(const char*); +} +} +using namespace WTF; +using namespace Unicode; +namespace JSC { +template <typename CharType> +static JSValue decode(ExecState* exec, const CharType* characters, int length, const char* doNotUnescape, bool strict) +{ + JSStringBuilder builder; + int k = 0; + UChar u = 0; + while (k < length) { + const CharType* p = characters + k; + CharType c = *p; + if (c == '%') { + int charLen = 0; + if (k <= length - 3 && isASCIIHexDigit(p[1]) && isASCIIHexDigit(p[2])) { + const char b0 = Lexer<CharType>::convertHex(p[1], p[2]); + const int sequenceLen = UTF8SequenceLength(b0); + if (sequenceLen && k <= length - sequenceLen * 3) { + charLen = sequenceLen * 3; + char sequence[5]; + if (charLen != 0) { + const int character = decodeUTF8Sequence(sequence); + if (character < 0 || character >= 0x110000) + charLen = 0; + else if (character >= 0x10000) { + builder.append(static_cast<UChar>(0xD800 | ((character - 0x10000) >> 10))); + } else + u = static_cast<UChar>(character); + } + } + } + } + } +} +static JSValue decode(ExecState* exec, const char* doNotUnescape, bool strict) +{ + UString str = exec->argument(0).toString(exec)->value(exec); + return decode(exec, str.characters8(), str.length(), doNotUnescape, strict); +} +EncodedJSValue globalFuncDecodeURI(ExecState* exec) +{ + static const char do_not_unescape_when_decoding_URI[] = + "#$&+,/:;=?@"; + return JSValue::encode(decode(exec, do_not_unescape_when_decoding_URI, true)); +} +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/opt/pr58006.C b/gcc-4.8/gcc/testsuite/g++.dg/opt/pr58006.C new file mode 100644 index 000000000..fd3b7bebd --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/opt/pr58006.C @@ -0,0 +1,22 @@ +// PR tree-optimization/58006 +// { dg-do compile } +// { dg-require-effective-target pthread } +// { dg-options "-Ofast -ftree-parallelize-loops=2" } + +extern "C" float sqrtf (float); + +struct S +{ + float i, j; + float foo () const { return sqrtf (i * i + j * j); } + S () : i (1), j (1) {} +}; + +void +bar (int a, int b) +{ + int i; + float f; + for (i = a; i < b; i++) + f = S ().foo (); +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/parse/crash62.C b/gcc-4.8/gcc/testsuite/g++.dg/parse/crash62.C new file mode 100644 index 000000000..04154f40c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/parse/crash62.C @@ -0,0 +1,6 @@ +// PR c++/58535 + +struct A +{ + template<int> virtual void foo(); // { dg-error "templates" } +}; diff --git a/gcc-4.8/gcc/testsuite/g++.dg/parse/ref-qual2.C b/gcc-4.8/gcc/testsuite/g++.dg/parse/ref-qual2.C new file mode 100644 index 000000000..a78597b0c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/parse/ref-qual2.C @@ -0,0 +1,6 @@ +// PR c++/57532 + +int main() +{ + return (int() & int()); +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/parse/using4.C b/gcc-4.8/gcc/testsuite/g++.dg/parse/using4.C new file mode 100644 index 000000000..2abe399f8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/parse/using4.C @@ -0,0 +1,20 @@ +// PR c++/58457 + +struct allocator +{ + void operator delete (void*); + void* operator new (__SIZE_TYPE__, void*); +}; + +struct type : public allocator +{ + type() {} + using allocator::operator new; + using allocator::operator delete; +}; + +int main() +{ + new (0) type; + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/pr57878.C b/gcc-4.8/gcc/testsuite/g++.dg/pr57878.C new file mode 100644 index 000000000..da4fc4bb5 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/pr57878.C @@ -0,0 +1,226 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-m32 -O2 -fno-omit-frame-pointer -fPIC -std=gnu++11" } */ + +typedef int int32; +typedef long long int64; +typedef unsigned int uint32; +typedef unsigned long long uint64; +namespace std { + typedef __SIZE_TYPE__ size_t; + template<class _CharT> + struct char_traits; + template<typename _Tp> + inline _Tp* __addressof(_Tp& __r) noexcept { + return reinterpret_cast<_Tp*> (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r))); + } + template<typename _Tp> + struct remove_reference { + typedef _Tp type; + }; + template<typename _Tp> + constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type& __t) noexcept { + return static_cast<_Tp&&>(__t); + } +} +typedef __SIZE_TYPE__ size_t; +extern "C++" { + inline void* operator new(std::size_t, void* __p) noexcept { + return __p; + } +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template<typename _Tp> + class new_allocator { + public: + typedef size_t size_type; + typedef _Tp* pointer; + }; +} +namespace std { + template<typename _Tp> + using __allocator_base = __gnu_cxx::new_allocator<_Tp>; + template<typename _Tp> + class allocator + : public __allocator_base<_Tp> { + public: + typedef size_t size_type; + template<typename _Tp1> + struct rebind { + typedef allocator<_Tp1> other; + }; + }; +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template<typename _CharT, typename _Traits, typename _Alloc> + class __sso_string_base; + template<typename _CharT, typename _Traits = std::char_traits<_CharT>, typename _Alloc = std::allocator<_CharT>, template <typename, typename, typename> class _Base = __sso_string_base> + class __versa_string; + template<typename _CharT, typename _Traits, typename _Alloc> + struct __vstring_utility { + typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; + template<typename _Alloc1> + struct _Alloc_hider + : public _Alloc1 { + _Alloc_hider(const _Alloc1& __a, _CharT* __ptr) + : _Alloc1(__a), _M_p(__ptr) { + } + _CharT* _M_p; + }; + }; + template<typename _CharT, typename _Traits, typename _Alloc> + class __sso_string_base + : protected __vstring_utility<_CharT, _Traits, _Alloc> { + typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base; + typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type; + typedef typename _CharT_alloc_type::size_type size_type; + private: + typename _Util_Base::template _Alloc_hider<_CharT_alloc_type> + _M_dataplus; + size_type _M_string_length; + enum { + _S_local_capacity = 15 }; + union { + _CharT _M_local_data[_S_local_capacity + 1]; + }; + template<typename _InIterator> + void _M_construct(_InIterator __beg, _InIterator __end); + public: + size_type _M_max_size() const; + _CharT* _M_data() const { + return _M_dataplus._M_p; + } + size_type _M_length() const { + return _M_string_length; + } + __sso_string_base(const __sso_string_base& __rcs); + const _CharT_alloc_type& _M_get_allocator() const { + } + }; + template<typename _CharT, typename _Traits, typename _Alloc> + __sso_string_base<_CharT, _Traits, _Alloc>:: __sso_string_base(const __sso_string_base& __rcs) + : _M_dataplus(__rcs._M_get_allocator(), _M_local_data) { + _M_construct(__rcs._M_data(), __rcs._M_data() + __rcs._M_length()); + } + template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> + class __versa_string + : private _Base<_CharT, _Traits, _Alloc> { + }; +} +template<typename _CharT, typename _Traits = std::char_traits<_CharT>, typename _Alloc = std::allocator<_CharT> > +class basic_string + : public __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc> { +}; +typedef basic_string<char> string; +namespace std __attribute__ ((__visibility__ ("default"))) { + template<typename _Alloc, typename _Tp> + class __alloctr_rebind_helper { + public: + static const bool __value = true; + }; + template<typename _Alloc, typename _Tp, bool = __alloctr_rebind_helper<_Alloc, _Tp>::__value> + struct __alloctr_rebind; + template<typename _Alloc, typename _Tp> struct __alloctr_rebind<_Alloc, _Tp, true> + { + typedef typename _Alloc::template rebind<_Tp>::other __type; + }; + template<typename _Alloc> + struct allocator_traits { + private: + template<typename _Tp> + static typename _Tp::pointer _S_pointer_helper(_Tp*); + typedef decltype(_S_pointer_helper((_Alloc*)0)) __pointer; + public: + typedef __pointer pointer; + template<typename _Tp> + using rebind_alloc = typename __alloctr_rebind<_Alloc, _Tp>::__type; + }; +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template<typename _Alloc> struct __alloc_traits + : std::allocator_traits<_Alloc> + { + typedef std::allocator_traits<_Alloc> _Base_type; + template<typename _Tp> + struct rebind { + typedef typename _Base_type::template rebind_alloc<_Tp> + other; + }; + }; +} +namespace std __attribute__ ((__visibility__ ("default"))) { + template<typename _T1, typename... _Args> + inline void _Construct(_T1* __p, _Args&&... __args) { + ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); + } + template<typename _Tp, typename _Alloc> + struct _Vector_base { + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type; + typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer pointer; + struct _Vector_impl + : public _Tp_alloc_type { + pointer _M_start; + pointer _M_finish; + }; + public: + _Vector_impl _M_impl; + }; + template<typename _Tp, typename _Alloc = std::allocator<_Tp> > + class vector + : protected _Vector_base<_Tp, _Alloc> { + typedef _Vector_base<_Tp, _Alloc> _Base; + public: + typedef _Tp value_type; + typedef typename _Base::pointer pointer; + typedef size_t size_type; + size_type size() const; + void push_back(const value_type& __x) { + _M_emplace_back_aux(__x); + } + template<typename... _Args> + void _M_emplace_back_aux(_Args&&... __args); + size_type _M_check_len(); + }; + template<typename _Tp, typename _Alloc> template<typename... _Args> + void vector<_Tp, _Alloc>:: _M_emplace_back_aux(_Args&&... __args) { + const size_type __len = _M_check_len(); + pointer __new_start(static_cast<pointer>(::operator new(__len * sizeof(_Tp)))); + pointer __new_temp(__new_start + size()); + ::new((void *)__new_temp) _Tp(std::forward<_Args>(__args)...); + pointer __cur = __new_start; + pointer __first = this->_M_impl._M_start; + pointer __last = this->_M_impl._M_finish; + for (; + __first != __last; + ++__first, ++__cur) std::_Construct(std::__addressof(*__cur), *__first); + } +} +using std::vector; +class DL { +public: + struct ChunkId { + int64 disk_id; + uint64 handle; + uint64 version; + string capability; + ChunkId(); + }; + struct ChunkInfo { + ChunkId id; + uint64 mtime; + uint32 length; + int32 space_used; + }; +}; +class FDB { + void CollectChunk(const DL::ChunkInfo& chunk, const int& location); +private: + struct ChunkData { + int location; + DL::ChunkInfo chunk_info; + }; + vector<ChunkData> chunk_data_; +}; +void FDB::CollectChunk(const DL::ChunkInfo& chunk, const int& location) { + ChunkData chunk_data; + chunk_data_.push_back( chunk_data); +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/abstract1.C b/gcc-4.8/gcc/testsuite/g++.dg/template/abstract1.C new file mode 100644 index 000000000..20bbf5a91 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/template/abstract1.C @@ -0,0 +1,12 @@ +// PR c++/58022 + +template <class T> struct A { }; +template <class T> A<T> & operator<< (A<T>&, T); +template <class T> class foo; +template <class T> A<char> & operator<<(A<char>& o, const foo<T>& l); +template <class T> class foo { + friend A<char>& operator<< <T> (A<char>& o, const foo<T>& l); +}; +class bar; +foo<bar> fb; +class bar { virtual void baz()=0; }; diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/access27.C b/gcc-4.8/gcc/testsuite/g++.dg/template/access27.C new file mode 100644 index 000000000..967e10f6a --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/template/access27.C @@ -0,0 +1,17 @@ +// PR c++/57550 + +template <bool (double)> bool Wrapper(double); +template <class T> void MakeHandler(bool (T)); + +class Handler +{ +public: + template <typename T> static void SetPrimitiveHandlers() + { + MakeHandler(Wrapper<Append<T> >); + } +private : + template <typename T> static bool Append(T); +}; + +template void Handler::SetPrimitiveHandlers<double>(); diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/arg9.C b/gcc-4.8/gcc/testsuite/g++.dg/template/arg9.C new file mode 100644 index 000000000..41af11486 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/template/arg9.C @@ -0,0 +1,8 @@ +// PR c++/57771 +// { dg-do compile } + +template <int N> +struct S {}; + +S <static_cast <int> (4>>2)> s1; +S <reinterpret_cast <int> (4>>2)> s2; diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/delete2.C b/gcc-4.8/gcc/testsuite/g++.dg/template/delete2.C new file mode 100644 index 000000000..b6ab380c9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/template/delete2.C @@ -0,0 +1,26 @@ +// PR c++/58119 + +template <class T> +struct A +{ + operator T*(); + template <class U> + operator A<U>(); +}; + +template <class T> +struct B +{ + operator T*(); + template <class U> + operator A<U>*(); +}; + +int main() +{ + A<int> a; + delete a; + + B<int> b; + delete b; // { dg-error "template|delete" } +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/inherit9.C b/gcc-4.8/gcc/testsuite/g++.dg/template/inherit9.C new file mode 100644 index 000000000..926343b4e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/template/inherit9.C @@ -0,0 +1,15 @@ +// PR c++/58273 + +class A {}; +class B +{ + int goo(A); +}; +template<typename E> +class D : public B +{ + void foo(A t) + { + int const i(B::goo(t)); + } +}; diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/using23.C b/gcc-4.8/gcc/testsuite/g++.dg/template/using23.C new file mode 100644 index 000000000..abb90de4c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/template/using23.C @@ -0,0 +1,15 @@ +// PR c++/57831 + +struct A { + void f(); +}; +template <class T> struct B : T { + typedef T base; + using base::f; // If I write "using B<T>::f" it's ok + void g( ) { + B<T>::f(); // This is OK as expected + (this->*&T::f)(); // This is also OK + (this->*&B<T>::f)(); // This causes error + } +}; +template struct B< A >; diff --git a/gcc-4.8/gcc/testsuite/g++.dg/uninit-pred-4.C b/gcc-4.8/gcc/testsuite/g++.dg/uninit-pred-4.C new file mode 100644 index 000000000..94ab13c50 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/uninit-pred-4.C @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-Wuninitialized -Og" } */ + +int pop (); +int pop_first_bucket; + +int my_pop () +{ + int out; // { dg-bogus "uninitialized" "uninitialized variable warning" } + + while (pop_first_bucket) + if (pop_first_bucket && (out = pop())) + return out; + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/warn/Wunused-var-21.C b/gcc-4.8/gcc/testsuite/g++.dg/warn/Wunused-var-21.C new file mode 100644 index 000000000..d279e5980 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/warn/Wunused-var-21.C @@ -0,0 +1,31 @@ +// PR c++/58325 +// { dg-do compile } +// { dg-options "-Wunused" } + +void +f1 () +{ + int *volatile a = new int[1]; + delete[] a; +} + +void +f2 () +{ + int *b = new int[1]; + delete[] b; +} + +void +f3 () +{ + int *volatile c = new int; + delete c; +} + +void +f4 () +{ + int *d = new int; + delete d; +} |