plateform
stringclasses 1
value | repo_name
stringclasses 2
values | name
stringlengths 1
78
| ext
stringclasses 2
values | path
stringlengths 15
1.11k
| size
int64 1
8.55M
| source_encoding
stringclasses 11
values | md5
stringlengths 32
32
| text
stringlengths 0
8.49M
|
---|---|---|---|---|---|---|---|---|
google
|
chromium
|
variadic69
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic69.C
| 674 |
utf_8
|
665d96dfa136ff270f42ff15c4021491
|
// { dg-options "-std=gnu++0x" }
template<typename T>
struct stored_value
{
explicit stored_value() : value() { }
explicit stored_value(const T& value) : value(value) { }
stored_value(int, const T& value) : value(value) { }
T value;
};
template<typename... Values>
struct myclass : public stored_value<Values>...
{
myclass() { }
explicit myclass(const Values&... values)
: stored_value<Values>(values)... { }
explicit myclass(int x, const Values&... values)
: stored_value<Values>(x, values)... { }
};
void f()
{
int i;
float f;
myclass<int*, float*> ifp1;
myclass<int*, float*> ifp2(&i, &f);
myclass<int*, float*> ifp3(1, &i, &f);
}
|
google
|
chromium
|
variadic24
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic24.C
| 158 |
utf_8
|
7ee5e10d775f659b178e9e2605776202
|
// { dg-options "-std=gnu++0x" }
template<typename T, T... Values>
struct vector_c { };
vector_c<int, 17, 42> intvec;
vector_c<char, 'a', 'b', 'c'> charvec;
|
google
|
chromium
|
variadic35
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic35.C
| 240 |
utf_8
|
667bf0290b01ee52046a37c46987246c
|
// { dg-options "-std=gnu++0x" }
template<int I, typename... Args>
void get_ith(const Args&... args);
void f()
{
get_ith<1, float>(1, 2.0, 'x');
get_ith<1, int, double, char, int>(1, 2.0, 'x'); // { dg-error "no matching function" }
}
|
google
|
chromium
|
decltype-33837
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/decltype-33837.C
| 182 |
utf_8
|
9a0ace8a7ebbf5d7255b172011b808ca
|
// { dg-options -std=c++0x }
// PR c++/33837
void foo()
{
__decltype (A::foo()); // { dg-error "was not declared|expected" }
__decltype (B); // { dg-error "was not declared" }
}
|
google
|
chromium
|
variadic3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic3.C
| 142 |
utf_8
|
a0fc4b5dd9895b5fe6a68628d4db6380
|
// { dg-options "-std=gnu++0x" }
template<typename... Args>
class tuple {};
void f()
{
tuple<> x;
tuple<int> y;
tuple<int, float> z;
}
|
google
|
chromium
|
initlist25
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/initlist25.C
| 248 |
utf_8
|
5673b623874e372b643d0dac08b0caa4
|
// PR c++/41754
// { dg-options -std=c++0x }
// { dg-do run }
#include <map>
#include <string>
#include <iostream>
using namespace std;
int main()
{
map<string, string> m;
m.insert({{"t", "t"}, {"y", "y"}});
return 0;
}
|
google
|
chromium
|
variadic67
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic67.C
| 516 |
utf_8
|
73d538726d20c793ad5bb11ff74edfb9
|
// { dg-options "-std=gnu++0x" }
template<typename... Elements> struct tuple {};
template<typename... Args>
struct nested
{
typedef tuple<tuple<Args, Args...>...> type;
};
template<typename T, typename U>
struct is_same
{
static const bool value = false;
};
template<typename T>
struct is_same<T, T>
{
static const bool value = true;
};
int a0[is_same<nested<int, float>::type,
tuple<tuple<int, int, float>,
tuple<float, int, float> > >::value? 1 : -1];
|
google
|
chromium
|
variadic50
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic50.C
| 150 |
utf_8
|
b2b9d3b9454eacd2fabfc51ba4493191
|
// { dg-options "-std=gnu++0x" }
int& f(int, double, ...);
template<typename... Args>
float& f(Args...);
float& g() {
return f(17, 3.14159, 3);
}
|
google
|
chromium
|
rv5n
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/rv5n.C
| 19,333 |
utf_8
|
e0ce83c49b788d80830771302f42cc3d
|
// I, Howard Hinnant, hereby place this code in the public domain.
// Test overlaod resolution among referece types
// { dg-do compile }
// { dg-options "-std=c++0x" }
template <bool> struct sa;
template <> struct sa<true> {};
struct one {char x[1];};
struct two {char x[2];};
struct three {char x[3];};
struct four {char x[4];};
struct five {char x[5];};
struct six {char x[6];};
struct seven {char x[7];};
struct eight {char x[8];};
struct A
{
A();
A(const volatile A&&);
};
A source();
const A c_source();
volatile A v_source();
const volatile A cv_source();
// 5 at a time
one sink_5_12345( A&); // { dg-message "candidates" }
two sink_5_12345(const A&); // { dg-message "note" }
three sink_5_12345(volatile A&); // { dg-message "note" }
four sink_5_12345(const volatile A&); // { dg-message "note" }
five sink_5_12345( A&&); // { dg-message "note" }
int test5_12345()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_12345(v_source()); // { dg-error "no match" }
sink_5_12345(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_12346( A&); // { dg-message "candidates" }
two sink_5_12346(const A&); // { dg-message "note" }
three sink_5_12346(volatile A&); // { dg-message "note" }
four sink_5_12346(const volatile A&); // { dg-message "note" }
six sink_5_12346(const A&&); // { dg-message "note" }
int test5_12346()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_12346(v_source()); // { dg-error "no match" }
sink_5_12346(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_12347( A&); // { dg-message "candidates" }
two sink_5_12347(const A&); // { dg-message "note" }
three sink_5_12347(volatile A&); // { dg-message "note" }
four sink_5_12347(const volatile A&); // { dg-message "note" }
seven sink_5_12347(volatile A&&); // { dg-message "note" }
int test5_12347()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_12347(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_12356( A&); // { dg-message "candidates" }
two sink_5_12356(const A&); // { dg-message "note" }
three sink_5_12356(volatile A&); // { dg-message "note" }
five sink_5_12356( A&&); // { dg-message "note" }
six sink_5_12356(const A&&); // { dg-message "note" }
int test5_12356()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_12356(cva); // { dg-error "no match" }
sink_5_12356(v_source()); // { dg-error "no match" }
sink_5_12356(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_12357( A&); // { dg-message "candidates" }
two sink_5_12357(const A&); // { dg-message "note" }
three sink_5_12357(volatile A&); // { dg-message "note" }
five sink_5_12357( A&&); // { dg-message "note" }
seven sink_5_12357(volatile A&&); // { dg-message "note" }
int test5_12357()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_12357(cva); // { dg-error "no match" }
sink_5_12357(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_12367( A&); // { dg-message "candidates" }
two sink_5_12367(const A&); // { dg-message "note" }
three sink_5_12367(volatile A&); // { dg-message "note" }
six sink_5_12367(const A&&); // { dg-message "note" }
seven sink_5_12367(volatile A&&); // { dg-message "note" }
int test5_12367()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_12367(cva); // { dg-error "no match" }
sink_5_12367(source()); // { dg-error "ambiguous" }
sink_5_12367(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_12456( A&); // { dg-message "candidates" }
two sink_5_12456(const A&); // { dg-message "note" }
four sink_5_12456(const volatile A&); // { dg-message "note" }
five sink_5_12456( A&&); // { dg-message "note" }
six sink_5_12456(const A&&); // { dg-message "note" }
int test5_12456()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_12456(v_source()); // { dg-error "no match" }
sink_5_12456(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_12457( A&); // { dg-message "candidates" }
two sink_5_12457(const A&); // { dg-message "note" }
four sink_5_12457(const volatile A&); // { dg-message "note" }
five sink_5_12457( A&&); // { dg-message "note" }
seven sink_5_12457(volatile A&&); // { dg-message "note" }
int test5_12457()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_12457(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_12467( A&); // { dg-message "candidates" }
two sink_5_12467(const A&); // { dg-message "note" }
four sink_5_12467(const volatile A&); // { dg-message "note" }
six sink_5_12467(const A&&); // { dg-message "note" }
seven sink_5_12467(volatile A&&); // { dg-message "note" }
int test5_12467()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_12467(source()); // { dg-error "ambiguous" }
sink_5_12467(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_12567( A&); // { dg-message "candidates" }
two sink_5_12567(const A&); // { dg-message "note" }
five sink_5_12567( A&&); // { dg-message "note" }
six sink_5_12567(const A&&); // { dg-message "note" }
seven sink_5_12567(volatile A&&); // { dg-message "note" }
int test5_12567()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_12567(cva); // { dg-error "no match" }
sink_5_12567(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_12678( A&);
two sink_5_12678(const A&); // { dg-message "candidates" }
six sink_5_12678(const A&&); // { dg-message "note" }
seven sink_5_12678(volatile A&&); // { dg-message "note" }
eight sink_5_12678(const volatile A&&); // { dg-message "note" }
int test5_12678()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_12678(source()); // { dg-error "ambiguous" }
return 0;
}
one sink_5_13456( A&); // { dg-message "candidates" }
three sink_5_13456(volatile A&); // { dg-message "note" }
four sink_5_13456(const volatile A&); // { dg-message "note" }
five sink_5_13456( A&&); // { dg-message "note" }
six sink_5_13456(const A&&); // { dg-message "note" }
int test5_13456()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_13456(v_source()); // { dg-error "no match" }
sink_5_13456(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_13457( A&); // { dg-message "candidates" }
three sink_5_13457(volatile A&); // { dg-message "note" }
four sink_5_13457(const volatile A&); // { dg-message "note" }
five sink_5_13457( A&&); // { dg-message "note" }
seven sink_5_13457(volatile A&&); // { dg-message "note" }
int test5_13457()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_13457(c_source()); // { dg-error "no match" }
sink_5_13457(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_13467( A&); // { dg-message "candidates" }
three sink_5_13467(volatile A&); // { dg-message "note" }
four sink_5_13467(const volatile A&); // { dg-message "note" }
six sink_5_13467(const A&&); // { dg-message "note" }
seven sink_5_13467(volatile A&&); // { dg-message "note" }
int test5_13467()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_13467(source()); // { dg-error "ambiguous" }
sink_5_13467(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_13567( A&); // { dg-message "candidates" }
three sink_5_13567(volatile A&); // { dg-message "note" }
five sink_5_13567( A&&); // { dg-message "note" }
six sink_5_13567(const A&&); // { dg-message "note" }
seven sink_5_13567(volatile A&&); // { dg-message "note" }
int test5_13567()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_13567(cva); // { dg-error "no match" }
sink_5_13567(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_13678( A&);
three sink_5_13678(volatile A&);
six sink_5_13678(const A&&); // { dg-message "candidates" }
seven sink_5_13678(volatile A&&); // { dg-message "note" }
eight sink_5_13678(const volatile A&&); // { dg-message "note" }
int test5_13678()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_13678(source()); // { dg-error "ambiguous" }
return 0;
}
one sink_5_14567( A&); // { dg-message "candidates" }
four sink_5_14567(const volatile A&); // { dg-message "note" }
five sink_5_14567( A&&); // { dg-message "note" }
six sink_5_14567(const A&&); // { dg-message "note" }
seven sink_5_14567(volatile A&&); // { dg-message "note" }
int test5_14567()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_14567(cv_source()); // { dg-error "no match" }
return 0;
}
one sink_5_14678( A&);
four sink_5_14678(const volatile A&);
six sink_5_14678(const A&&); // { dg-message "candidates" }
seven sink_5_14678(volatile A&&); // { dg-message "note" }
eight sink_5_14678(const volatile A&&); // { dg-message "note" }
int test5_14678()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_14678(source()); // { dg-error "ambiguous" }
return 0;
}
two sink_5_23456(const A&); // { dg-message "candidates" }
three sink_5_23456(volatile A&); // { dg-message "note" }
four sink_5_23456(const volatile A&); // { dg-message "note" }
five sink_5_23456( A&&); // { dg-message "note" }
six sink_5_23456(const A&&); // { dg-message "note" }
int test5_23456()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_23456(a); // { dg-error "ambiguous" }
sink_5_23456(v_source()); // { dg-error "no match" }
sink_5_23456(cv_source()); // { dg-error "no match" }
return 0;
}
two sink_5_23457(const A&); // { dg-message "candidates" }
three sink_5_23457(volatile A&); // { dg-message "note" }
four sink_5_23457(const volatile A&); // { dg-message "note" }
five sink_5_23457( A&&); // { dg-message "note" }
seven sink_5_23457(volatile A&&); // { dg-message "note" }
int test5_23457()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_23457(a); // { dg-error "ambiguous" }
sink_5_23457(cv_source()); // { dg-error "no match" }
return 0;
}
two sink_5_23458(const A&); // { dg-message "candidates" }
three sink_5_23458(volatile A&); // { dg-message "note" }
four sink_5_23458(const volatile A&); // { dg-message "note" }
five sink_5_23458( A&&); // { dg-message "note" }
eight sink_5_23458(const volatile A&&); // { dg-message "note" }
int test5_23458()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_23458(a); // { dg-error "ambiguous" }
return 0;
}
two sink_5_23467(const A&); // { dg-message "candidates" }
three sink_5_23467(volatile A&); // { dg-message "note" }
four sink_5_23467(const volatile A&); // { dg-message "note" }
six sink_5_23467(const A&&); // { dg-message "note" }
seven sink_5_23467(volatile A&&); // { dg-message "note" }
int test5_23467()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_23467(a); // { dg-error "ambiguous" }
sink_5_23467(source()); // { dg-error "ambiguous" }
sink_5_23467(cv_source()); // { dg-error "no match" }
return 0;
}
two sink_5_23468(const A&); // { dg-message "candidates" }
three sink_5_23468(volatile A&); // { dg-message "note" }
four sink_5_23468(const volatile A&); // { dg-message "note" }
six sink_5_23468(const A&&); // { dg-message "note" }
eight sink_5_23468(const volatile A&&); // { dg-message "note" }
int test5_23468()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_23468(a); // { dg-error "ambiguous" }
return 0;
}
two sink_5_23478(const A&); // { dg-message "candidates" }
three sink_5_23478(volatile A&); // { dg-message "note" }
four sink_5_23478(const volatile A&); // { dg-message "note" }
seven sink_5_23478(volatile A&&); // { dg-message "note" }
eight sink_5_23478(const volatile A&&); // { dg-message "note" }
int test5_23478()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_23478(a); // { dg-error "ambiguous" }
return 0;
}
two sink_5_23567(const A&); // { dg-message "candidates" }
three sink_5_23567(volatile A&); // { dg-message "note" }
five sink_5_23567( A&&); // { dg-message "note" }
six sink_5_23567(const A&&); // { dg-message "note" }
seven sink_5_23567(volatile A&&); // { dg-message "note" }
int test5_23567()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_23567(a); // { dg-error "ambiguous" }
sink_5_23567(cva); // { dg-error "no match" }
sink_5_23567(cv_source()); // { dg-error "no match" }
return 0;
}
two sink_5_23568(const A&); // { dg-message "candidates" }
three sink_5_23568(volatile A&); // { dg-message "note" }
five sink_5_23568( A&&); // { dg-message "note" }
six sink_5_23568(const A&&); // { dg-message "note" }
eight sink_5_23568(const volatile A&&); // { dg-message "note" }
int test5_23568()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_23568(a); // { dg-error "ambiguous" }
return 0;
}
two sink_5_23578(const A&); // { dg-message "candidates" }
three sink_5_23578(volatile A&); // { dg-message "note" }
five sink_5_23578( A&&); // { dg-message "note" }
seven sink_5_23578(volatile A&&); // { dg-message "note" }
eight sink_5_23578(const volatile A&&); // { dg-message "note" }
int test5_23578()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_23578(a); // { dg-error "ambiguous" }
return 0;
}
two sink_5_23678(const A&); // { dg-message "candidates" }
three sink_5_23678(volatile A&); // { dg-message "note" }
six sink_5_23678(const A&&); // { dg-message "note" }
seven sink_5_23678(volatile A&&); // { dg-message "note" }
eight sink_5_23678(const volatile A&&); // { dg-message "note" }
int test5_23678()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_23678(a); // { dg-error "ambiguous" }
sink_5_23678(source()); // { dg-error "ambiguous" }
return 0;
}
two sink_5_24567(const A&); // { dg-message "candidates" }
four sink_5_24567(const volatile A&); // { dg-message "note" }
five sink_5_24567( A&&); // { dg-message "note" }
six sink_5_24567(const A&&); // { dg-message "note" }
seven sink_5_24567(volatile A&&); // { dg-message "note" }
int test5_24567()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_24567(cv_source()); // { dg-error "no match" }
return 0;
}
two sink_5_24678(const A&); // { dg-message "candidates" }
four sink_5_24678(const volatile A&);
six sink_5_24678(const A&&); // { dg-message "note" }
seven sink_5_24678(volatile A&&); // { dg-message "note" }
eight sink_5_24678(const volatile A&&); // { dg-message "note" }
int test5_24678()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_24678(source()); // { dg-error "ambiguous" }
return 0;
}
three sink_5_34567(volatile A&); // { dg-message "candidates" }
four sink_5_34567(const volatile A&); // { dg-message "note" }
five sink_5_34567( A&&); // { dg-message "note" }
six sink_5_34567(const A&&); // { dg-message "note" }
seven sink_5_34567(volatile A&&); // { dg-message "note" }
int test5_34567()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_34567(cv_source()); // { dg-error "no match" }
return 0;
}
three sink_5_34678(volatile A&);
four sink_5_34678(const volatile A&);
six sink_5_34678(const A&&); // { dg-message "candidates" }
seven sink_5_34678(volatile A&&); // { dg-message "note" }
eight sink_5_34678(const volatile A&&); // { dg-message "note" }
int test5_34678()
{
A a;
const A ca = a;
volatile A va;
const volatile A cva = a;
sink_5_34678(source()); // { dg-error "ambiguous" }
return 0;
}
int main()
{
return test5_12356() + test5_12357() + test5_12367() + test5_12467() +
test5_12567() + test5_12678() + test5_13467() + test5_13567() +
test5_13678() + test5_13678() + test5_23456() + test5_23457() +
test5_23458() + test5_23467() + test5_23468() + test5_23478() +
test5_23567() + test5_23568() + test5_23578() + test5_23678() +
test5_24678() + test5_34678();
}
|
google
|
chromium
|
variadic11
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic11.C
| 494 |
utf_8
|
fd232fd0f9ee4ead299f8f5377eacce2
|
// { dg-options "-std=gnu++0x" }
template<typename...> struct count;
template<>
struct count<> {
static const int value = 0;
};
template<typename T, typename... Args>
struct count<T, Args...> {
static const int value = 1 + count<Args...>::value;
};
int a0[count<>::value == 0? 1 : -1];
int a1[count<char>::value == 1? 1 : -1];
int a2[count<char, short>::value == 2? 1 : -1];
int a3[count<char, short, int>::value == 3? 1 : -1];
int a4[count<char, short, int, long>::value == 4? 1 : -1];
|
google
|
chromium
|
pr31444
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/pr31444.C
| 216 |
utf_8
|
ccea62e27b41f0e0b3068f61e335c3dd
|
// { dg-options "-std=gnu++0x" }
template<typename... T> struct A
{
template<int> void foo(A<T>); // { dg-error "not expanded|T" }
};
void bar()
{
A<int>().foo<0>(A<int>()); // { dg-error "no member named" }
};
|
google
|
chromium
|
variadic22
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic22.C
| 653 |
utf_8
|
3154647a4e099200d85e6844bce83814
|
// { dg-options "-std=gnu++0x" }
template<typename R, typename... ArgTypes>
struct make_function_type
{
typedef R type(ArgTypes... args);
};
template<typename T, typename U>
struct is_same {
static const bool value = false;
};
template<typename T>
struct is_same<T, T> {
static const bool value = true;
};
int a0[is_same<make_function_type<int>::type, int()>::value? 1 : -1];
int a1[is_same<make_function_type<int, float>::type, int(float)>::value? 1 : -1];
int a2[is_same<make_function_type<int, float>::type, int(float)>::value? 1 : -1];
int a3[is_same<make_function_type<int, float, double>::type, int(float, double const)>::value? 1 : -1];
|
google
|
chromium
|
static_assert3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/static_assert3.C
| 158 |
utf_8
|
edacfa979d970ca2fd7315f06f7c5572
|
// { dg-options "-std=c++0x" }
static_assert(7 / 0, "X"); // { dg-error "non-constant condition" }
// { dg-warning "division by zero" "" { target *-*-* } 2 }
|
google
|
chromium
|
variadic16
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic16.C
| 682 |
utf_8
|
5e1e29412f063305c242c74862e86181
|
// { dg-options "-std=gnu++0x" }
template<typename R, typename... ArgTypes>
struct make_function_type
{
typedef R type(const ArgTypes&... args);
};
template<typename T, typename U>
struct is_same {
static const bool value = false;
};
template<typename T>
struct is_same<T, T> {
static const bool value = true;
};
int a0[is_same<make_function_type<int>::type, int()>::value? 1 : -1];
int a1[is_same<make_function_type<int, float>::type, int(const float&)>::value? 1 : -1];
int a2[is_same<make_function_type<int, float>::type, int(const float&)>::value? 1 : -1];
int a3[is_same<make_function_type<int, float, double>::type, int(const float&, double const&)>::value? 1 : -1];
|
google
|
chromium
|
template_deduction
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/template_deduction.C
| 1,856 |
utf_8
|
5dc8f6956bf6c99f9f94a90d119d3dc0
|
// I, Howard Hinnant, hereby place this code in the public domain.
// Test the "Augmented" template argument deduction when binding an lvalue to an rvalue reference.
// { dg-do compile }
// { dg-options "-std=c++0x" }
template <bool> struct sa;
template <> struct sa<true> {};
template <class T, T v>
struct integral_constant
{
static const T value = v;
typedef T value_type;
typedef integral_constant<T, v> type;
};
typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type;
template <class T> struct is_lvalue_reference : public integral_constant<bool, false> {};
template <class T> struct is_lvalue_reference<T&> : public integral_constant<bool, true> {};
template <class T> struct is_rvalue_reference : public integral_constant<bool, false> {};
template <class T> struct is_rvalue_reference<T&&> : public integral_constant<bool, true> {};
template <bool is_lvalue_ref, bool is_rvalue_ref, class T>
void
test1(T&&)
{
sa<is_lvalue_reference<T&&>::value == is_lvalue_ref> t1;
sa<is_rvalue_reference<T&&>::value == is_rvalue_ref> t2;
}
template <bool is_lvalue_ref, bool is_rvalue_ref, class T>
void
test2(const T&&)
{
sa<is_lvalue_reference<const T&&>::value == is_lvalue_ref> t1;
sa<is_rvalue_reference<const T&&>::value == is_rvalue_ref> t2;
}
template <bool is_lvalue_ref, bool is_rvalue_ref, class T>
void
test3(T*&&)
{
sa<is_lvalue_reference<T*&&>::value == is_lvalue_ref> t1;
sa<is_rvalue_reference<T*&&>::value == is_rvalue_ref> t2;
}
struct A {};
A a;
A source() {return A();}
A* sourcep() {return 0;}
int main()
{
test1<true, false>(a);
test1<false, true>(source());
test2<false, true>(a);
test2<false, true>(source());
test3<false, true>(&a);
test3<false, true>(sourcep());
return 0;
}
|
google
|
chromium
|
variadic59
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic59.C
| 194 |
utf_8
|
0cb58621c4a73b547de0ab5d24561cf5
|
// { dg-options "-std=gnu++0x" }
template<class T, typename... VarArgs>
void print(T t, VarArgs args); // { dg-error "packs not expanded" }
// { dg-message "VarArgs" "note" { target *-*-* } 3 }
|
google
|
chromium
|
pr32253
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/pr32253.C
| 146 |
utf_8
|
631cf47a14c5117c15a4729a3a035270
|
// { dg-options "-std=c++0x" }
template<void (*... fp)()> struct A
{
A() { fp(); } // { dg-error "not expanded|fp" }
};
void foo();
A<foo> a;
|
google
|
chromium
|
vt-34052
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/vt-34052.C
| 310 |
utf_8
|
f4757749a592f130d579f6b7e524b3ac
|
// { dg-options "-std=c++0x" }
template<typename... T, typename = T> struct A {}; // { dg-error "must be at the end" }
template<template<typename... T, typename = T> class U> struct B // { dg-error "must be at the end" }
{
template<int> U<int> foo(); // { dg-error "mismatch|constant|invalid|invalid" }
};
|
google
|
chromium
|
variadic29
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic29.C
| 1,042 |
utf_8
|
c7c53f1a850486e6679090c2406b30b6
|
// { dg-options "-std=gnu++0x" }
template<typename Signature>
struct function_traits;
template<typename R, typename... ArgTypes>
struct function_traits<R(ArgTypes...)> {
typedef R result_type;
};
template<typename R, typename Class, typename... ArgTypes>
struct function_traits<R (Class::*)(ArgTypes...)> {
typedef R result_type;
};
template<typename R, typename Class, typename... ArgTypes>
struct function_traits<R (Class::*)(ArgTypes...) const> {
typedef R result_type;
};
template<typename T, typename U>
struct same_type {
static const bool value = false;
};
template<typename T>
struct same_type<T, T> {
static const bool value = true;
};
struct X {};
int a0[same_type<function_traits<int (X::*)()>::result_type, int>::value? 1 : -1];
int a1[same_type<function_traits<int (X::*)(float)>::result_type, int>::value? 1 : -1];
int a2[same_type<function_traits<int (X::*)(double, char)>::result_type, int>::value? 1 : -1];
int a3[same_type<function_traits<int (X::*)(double, char) const>::result_type, int>::value? 1 : -1];
|
google
|
chromium
|
variadic31
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic31.C
| 159 |
utf_8
|
9692082ef4357394bc9aa5c71dead7e3
|
// { dg-options "-std=gnu++0x" }
template<typename... T>
void eat(T...) { }
void f()
{
eat();
eat(1);
eat(1, 2);
eat(17, 3.14159, "Hello, World!");
}
|
google
|
chromium
|
vt-34919
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/vt-34919.C
| 171 |
utf_8
|
183cc4d67f7796c4c307c41f08be2743
|
// { dg-options "-std=c++0x" }
template<int... N> struct A
{
static void foo()
{
int i = N; // { dg-error "not expanded|N" }
}
};
void bar()
{
A<0>::foo();
}
|
google
|
chromium
|
defaulted10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/defaulted10.C
| 272 |
utf_8
|
a01a2c278868a00c8a6181355290f624
|
// PR c++/40381
// { dg-options "-std=gnu++0x" }
struct A
{
template<typename T> void foo(T) = delete; // { dg-error "previously|deleted" }
};
template<typename T> void A::foo(T) {} // { dg-error "redefinition" }
void bar()
{
A().foo(0); // { dg-error "used" }
}
|
google
|
chromium
|
unnamed_refs
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C
| 521 |
utf_8
|
a460b87cdd4f4e41763d048e0fd1c15b
|
// I, Howard Hinnant, hereby place this code in the public domain.
// Test: Unamed rvalue references are treated as lvalues.
// { dg-do compile }
// { dg-options "-std=c++0x" }
template <bool> struct sa;
template <> struct sa<true> {};
struct one {char x[1];};
struct two {char x[2];};
struct A {};
one foo(const A&) {return one();}
two foo(A&&) {return two();}
A&& source() {static A a; return a;}
int test1()
{
sa<sizeof(foo(source())) == 2> t1;
return 0;
}
int main()
{
return test1();
}
|
google
|
chromium
|
variadic94
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/variadic94.C
| 411 |
utf_8
|
102cfb8090ee7187ab5a236addf1729f
|
// PR c++/40595
// { dg-options "-std=c++0x" }
template<int N>
struct S
{
typedef int type;
};
template<typename T>
struct Get
{
static T get();
};
template<typename F>
struct B
{
template<typename ... Args>
typename S<sizeof( Get<F>::get() (Get<Args>::get() ...) )>::type
f(Args&& ... a);
};
struct X
{
bool operator()(int) const;
};
int main()
{
B<X> b;
b.f(1);
}
|
google
|
chromium
|
decltype18
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/decltype18.C
| 103 |
utf_8
|
5619cfac0fb1689f9ed6c8d79af2b5ef
|
// PR c++/37875
// { dg-options "-std=c++0x" }
template <typename> struct X {};
X<decltype(1 > 2)> x;
|
google
|
chromium
|
auto1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/auto1.C
| 201 |
utf_8
|
41dfdfa19c5e84ceb06e83606870ff86
|
// { dg-options "-std=c++98 -Wc++0x-compat" }
// Test warning for use of auto in C++98 mode with C++0x
// compatibility warnings
void f()
{
auto int x = 5; // { dg-warning "will change meaning" }
}
|
google
|
chromium
|
enum2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/enum2.C
| 142 |
utf_8
|
a8073df4790689eb8b20d4a6f09abde1
|
// PR c++/38637
// { dg-do compile }
// { dg-options "-std=c++0x" }
template<int> enum E : int { e }; // { dg-error "declaration|expected" }
|
google
|
chromium
|
initlist17
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/initlist17.C
| 152 |
utf_8
|
d1ed66853d8a6eaa9eb8d3d0438f5752
|
// { dg-options "-std=c++0x" }
void f(int i);
int main()
{
f({42.0}); // { dg-error "narrowing" }
return {1.0}; // { dg-error "narrowing" }
}
|
google
|
chromium
|
pr32126
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/cpp0x/pr32126.C
| 233 |
utf_8
|
17104ea84b98016b8357de7549d60372
|
// { dg-options "-std=c++0x" }
template<typename...> struct A;
template<typename...T> struct A<T> // { dg-error "not expanded|T|" }
{
static int i;
};
A<char> a; // { dg-error "incomplete" }
A<int> b; // { dg-error "incomplete" }
|
google
|
chromium
|
gcov-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-3.C
| 348 |
utf_8
|
0e241a16c3faf2f0c387bd2978d2b824
|
/* Check that gcov doesn't abort when a static object is defined
within a header file. */
/* { dg-options "-fprofile-arcs -ftest-coverage" } */
/* { dg-do run { target native } } */
#include "gcov-3.h"
extern int foo();
int
main ()
{
return foo(); /* count(1) */
}
/* { dg-final { run-gcov gcov-3.C } } */
|
google
|
chromium
|
gcov-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-1.C
| 6,705 |
utf_8
|
ed8a6c94f1bc2e70a324d73a77190040
|
/* Check that execution counts and branch probabilities for various C
constructs are reported correctly by gcov. */
/* { dg-options "-fprofile-arcs -ftest-coverage" } */
/* { dg-do run { target native } } */
extern "C" void abort (void);
int do_something (int i)
{
return i;
}
/* Check static inline functions. */
int unref_val;
static inline int
unreferenced (int i, int j)
{
return i - j;
}
static inline int
uncalled (int i, int j)
{
return i * j;
}
static inline int
called (int i, int j)
{
return i + j; /* count(1) */
}
void
call_unref ()
{
if (unref_val) /* count(1) */
unref_val = uncalled (1, 2);
unref_val = called (unref_val, 4); /* count(1) */
}
/* Check for loops. */
int for_val1;
int for_val2;
int for_temp;
int
test_for1 (int n)
{
int i;
for_temp = 1; /* count(3) */
for (i = 0; i < n; i++) /* branch(25) */
/* branch(end) */
for_temp++; /* count(9) */
return for_temp; /* count(3) */
}
int
test_for2 (int m, int n, int o)
{
int i, j, k;
for_temp = 1; /* count(6) */
for (i = 0; i < n; i++) /* branch(30) */
/* branch(end) */
for (j = 0; j < m; j++) /* branch(32) */
/* branch(end) */
for (k = 0; k < o; k++) /* branch(27) */
/* branch(end) */
for_temp++; /* count(81) */
return for_temp; /* count(6) */
}
int
call_for ()
{
for_val1 += test_for1 (0);
for_val1 += test_for1 (2);
for_val1 += test_for1 (7);
for_val2 += test_for2 (0, 0, 0);
for_val2 += test_for2 (1, 0, 0);
for_val2 += test_for2 (1, 3, 0);
for_val2 += test_for2 (1, 3, 1);
for_val2 += test_for2 (3, 1, 5);
for_val2 += test_for2 (3, 7, 3);
}
/* Check the use of goto. */
int goto_val;
int
test_goto1 (int f)
{
/* branch(50) */
if (f) /* count(2) */
/* branch(end) */
goto lab1; /* count(1) */
return 1; /* count(1) */
lab1:
return 2; /* count(1) */
}
int
test_goto2 (int f)
{
int i;
/* branch(7) */
for (i = 0; i < 10; i++) /* count(15) */
/* branch(end) */
if (i == f) goto lab2; /* count(14) */
return 4; /* count(1) */
lab2:
return 8; /* count(1) */
}
void
call_goto ()
{
goto_val += test_goto1 (0);
goto_val += test_goto1 (1);
goto_val += test_goto2 (3);
goto_val += test_goto2 (30);
}
/* Check nested if-then-else statements. */
int ifelse_val1;
int ifelse_val2;
int ifelse_val3;
int
test_ifelse1 (int i, int j)
{
int result = 0;
/* branch(40) */
if (i) /* count(5) */
/* branch(0) */
if (j) /* count(3) */
/* branch(end) */
result = do_something (4); /* count(3) */
else
result = do_something (1024);
else
/* branch(50) */
if (j) /* count(2) */
/* branch(end) */
result = do_something (1); /* count(1) */
else
result = do_something (2); /* count(1) */
/* branch(80) */
if (i > j) /* count(5) */
/* branch(end) */
result = do_something (result*2); /* count(1) */
/* branch(80) */
if (i > 10) /* count(5) */
/* branch(100) */
if (j > 10) /* count(1) */
/* branch(end) */
result = do_something (result*4); /* count(1) */
return result; /* count(5) */
}
int
test_ifelse2 (int i)
{
int result = 0;
/* branch(83) */
if (!i) /* count(6) */
/* branch(end) */
result = do_something (1); /* count(1) */
/* branch(100) */
if (i == 1) /* count(6) */
/* branch(end) */
result = do_something (1024);
/* branch(50) */
if (i == 2) /* count(6) */
/* branch(end) */
result = do_something (2); /* count(3) */
/* branch(67) */
if (i == 3) /* count(6) */
/* branch(end) */
return do_something (8); /* count(2) */
/* branch(100) */
if (i == 4) /* count(4) */
/* branch(end) */
return do_something (2048);
return result; /* count(4) */
}
int
test_ifelse3 (int i, int j)
{
int result = 1;
/* branch(27 50 75) */
if (i > 10 && j > i && j < 20) /* count(11) */
/* branch(end) */
result = do_something (16); /* count(1) */
/* branch(55) */
if (i > 20) /* count(11) */
/* branch(60) */
if (j > i) /* count(5) */
/* branch(50) */
if (j < 30) /* count(2) */
/* branch(end) */
result = do_something (32); /* count(1) */
/* branch(9 10 89) */
if (i == 3 || j == 47 || i == j) /* count(11) */
/* branch(end) */
result = do_something (64); /* count(3) */
return result; /* count(11) */
}
void
call_ifelse ()
{
ifelse_val1 += test_ifelse1 (0, 2);
ifelse_val1 += test_ifelse1 (0, 0);
ifelse_val1 += test_ifelse1 (1, 2);
ifelse_val1 += test_ifelse1 (10, 2);
ifelse_val1 += test_ifelse1 (11, 11);
ifelse_val2 += test_ifelse2 (0);
ifelse_val2 += test_ifelse2 (2);
ifelse_val2 += test_ifelse2 (2);
ifelse_val2 += test_ifelse2 (2);
ifelse_val2 += test_ifelse2 (3);
ifelse_val2 += test_ifelse2 (3);
ifelse_val3 += test_ifelse3 (11, 19);
ifelse_val3 += test_ifelse3 (25, 27);
ifelse_val3 += test_ifelse3 (11, 22);
ifelse_val3 += test_ifelse3 (11, 10);
ifelse_val3 += test_ifelse3 (21, 32);
ifelse_val3 += test_ifelse3 (21, 20);
ifelse_val3 += test_ifelse3 (1, 2);
ifelse_val3 += test_ifelse3 (32, 31);
ifelse_val3 += test_ifelse3 (3, 0);
ifelse_val3 += test_ifelse3 (0, 47);
ifelse_val3 += test_ifelse3 (65, 65);
}
/* Check switch statements. */
int switch_val, switch_m;
int
test_switch (int i, int j)
{
int result = 0; /* count(5) */
/* branch(20 0 60 20) */
switch (i) /* count(5) */
/* branch(end) */
{
case 1:
result = do_something (2); /* count(1) */
break;
case 2:
result = do_something (1024);
break;
case 3:
case 4:
/* branch(67) */
if (j == 2) /* count(3) */
/* branch(end) */
return do_something (4); /* count(1) */
result = do_something (8); /* count(2) */
break;
default:
result = do_something (32); /* count(1) */
switch_m++; /* count(1) */
break;
}
return result; /* count(4) */
}
void
call_switch ()
{
switch_val += test_switch (1, 0);
switch_val += test_switch (3, 0);
switch_val += test_switch (3, 2);
switch_val += test_switch (4, 0);
switch_val += test_switch (16, 0);
switch_val += switch_m;
}
int
main()
{
call_for ();
call_goto ();
call_ifelse ();
call_switch ();
call_unref ();
if ((for_val1 != 12)
|| (for_val2 != 87)
|| (goto_val != 15)
|| (ifelse_val1 != 31)
|| (ifelse_val2 != 23)
|| (ifelse_val3 != 246)
|| (switch_val != 55)
|| (unref_val != 4))
abort ();
return 0;
}
/* { dg-final { run-gcov branches { -b gcov-1.C } } } */
|
google
|
chromium
|
gcov-6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-6.C
| 309 |
utf_8
|
0db2a2956de58970834889c74f43082d
|
// PR gcov-profile/34609
// { dg-do compile }
// { dg-options "-O -ftest-coverage" }
struct A
{
int i;
int &get () { return i; }
};
inline A foo ()
{
A a;
a.get ();
return a;
}
inline A bar ()
{
return foo ();
}
void baz ()
{
A a;
a = bar ();
}
// { dg-final { cleanup-coverage-files } }
|
google
|
chromium
|
gcov-4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-4.C
| 785 |
utf_8
|
a7c093e32d8e0cc08e02c3253748979c
|
/* Check that execution counts and branch probabilities for various C
constructs are reported correctly by gcov. */
#include <stdio.h>
/* { dg-options "-fprofile-arcs -ftest-coverage -fno-exceptions" } */
/* { dg-do run { target native } } */
class foo {
public:
foo() { printf("foo()\n"); };
~foo() { printf("~foo()\n"); };
void method(void) { printf("method()\n"); };
};
int func(int i, int j) __attribute__((noinline));
int func(int i, int j){
if (j) {
printf("unreachable\n");
return 3;
}
foo f;
if (i == 1) {
f.method();
f.method();
} else {
f.method();
printf("unreachable\n");
return 2; /* count(#####) */
}
f.method();
return 0;
}
int main() {
return func(1, 0);
}
/* { dg-final { run-gcov gcov-4.C } } */
|
google
|
chromium
|
gcov-2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-2.C
| 465 |
utf_8
|
afab866e59f46409fb68aa64174f3acf
|
/* Verify line coverage counts for simple member functions. */
/* { dg-options "-fprofile-arcs -ftest-coverage" } */
/* { dg-do run { target native } } */
class C {
public:
C()
{
i = 0; /* count(1) */
}
~C() {}
void seti (int j)
{
i = j; /* count(1) */
}
private:
int i;
};
void foo()
{
C c; /* count(1) */
c.seti (1); /* count(1) */
}
int main()
{
foo(); /* count(1) */
}
/* { dg-final { run-gcov gcov-2.C } } */
|
google
|
chromium
|
gcov-5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-5.C
| 928 |
utf_8
|
8ade32db1de614a89b3775d4d1d03415
|
/* Check that execution counts for template functions
are reported correctly by gcov. */
#include <stdio.h>
#include <stdlib.h>
/* { dg-options "-fprofile-arcs -ftest-coverage -fno-inline" } */
/* { dg-do run { target native } } */
class A {
int count;
public:
A(int c) { count = c; }
void func(void) { printf("func\n"); }
bool done(void) {
return (count == 0) ? true : (count-- != 0);
}
void run(void) { abort(); }
};
//typedef A T;
template<class T>
void WithoutBrace(T *a) {
while (!a->done())
a->run(); /* count(#####) */
} /* count(1) */
template<class T>
void WithBrace(T *a)
{
while (!a->done())
{
a->run(); /* count(#####) */
}
} /* count(1) */
A *func(A *a)
{
WithoutBrace(a);
WithBrace(a);
return a;
}
int main() {
A a(0);
func(&a);
return 0;
}
/* { dg-final { run-gcov gcov-5.C } } */
|
google
|
chromium
|
cond6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/cond6.C
| 322 |
utf_8
|
7a1a3b98a22e73124c10abe63b9e58eb
|
// PR c++/11283
// Converting "a" to the type of "i" produces "int" rather than "const
// int", which was causing build_conditional_expr to abort. But we don't
// care about cv-quals on non-class rvalues.
struct A
{
operator int ();
};
extern A a;
extern const int i;
extern bool b;
int f ()
{
return b ? a : i;
}
|
google
|
chromium
|
bitfield10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield10.C
| 331 |
utf_8
|
38f6bad87ae88f3b5e8814eb2a0cb3cd
|
// PR c++/38007
// We need to use the conversion function to the declared type of a bitfield,
// not the lowered bitfield type.
// { dg-do link }
struct A
{
operator unsigned int() { return 42; }
operator unsigned char();
};
struct B
{
unsigned int b : 8;
};
int
main ()
{
A u;
unsigned int v = u;
B w;
w.b = u;
}
|
google
|
chromium
|
ptrmem2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem2.C
| 1,431 |
utf_8
|
3690e02d434485ce8753b6e24f99aea9
|
// { dg-do compile }
// Assorted pointer to data member static cast tests.
struct A { int x; };
struct B : A { int x; };
struct P : A { int x; };
struct V { int x; };
struct D : B, virtual V, private P { int x; };
// Valid static casts.
int B::*p1 = static_cast<int B::*>(&D::x);
int D::*p2 = static_cast<int D::*>(&B::x);
// Virtual base class.
int V::*p3 = static_cast<int V::*>(&D::x); // { dg-error "" }
int D::*p4 = static_cast<int D::*>(&V::x); // { dg-error "" }
// Inaccessible base class.
int P::*p5 = static_cast<int P::*>(&D::x); // { dg-error "" }
int D::*p6 = static_cast<int D::*>(&P::x); // { dg-error "" }
// Ambiguous base class.
int A::*p7 = static_cast<int A::*>(&D::x); // { dg-error "" }
int D::*p8 = static_cast<int D::*>(&A::x); // { dg-error "" }
// Valid conversions which increase cv-qualification.
const int B::*p9 = static_cast<const int B::*>(&D::x);
const int D::*p10 = static_cast<const int D::*>(&B::x);
// Invalid conversions which decrease cv-qualification.
int B::*p11 = static_cast<int B::*>(p10); // { dg-error "casts away constness" }
int D::*p12 = static_cast<int D::*>(p9); // { dg-error "casts away constness" }
// Attempts to change member type.
float B::*p13 = static_cast<float B::*>(&D::x); // { dg-error "" }
float D::*p14 = static_cast<float D::*>(&B::x); // { dg-error "" }
|
google
|
chromium
|
bitfield9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield9.C
| 205 |
utf_8
|
e957e40d1b691f5227994efd43cc2472
|
// PR c++/35909
// { dg-do compile }
struct MidiCommand
{
unsigned data1 : 8;
};
void g(const unsigned char &);
void h(const unsigned int &);
void f(MidiCommand mc)
{
g(mc.data1);
h(mc.data1);
}
|
google
|
chromium
|
const2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/const2.C
| 141 |
utf_8
|
cd42b5b37923de04f2f1d946dfbd433c
|
struct B {};
struct D : public B {};
typedef int B::*bm;
typedef int D::*dm;
bm bp;
void f() {
const_cast<dm>(bp); // { dg-error "" }
}
|
google
|
chromium
|
self1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/self1.C
| 131 |
utf_8
|
9f33237b06a0754b17722be2e4ac5adf
|
// PR c++/31419
struct B
{
template<typename T>
operator T const& () const
{
return 42;
}
};
B f()
{
return B();
}
|
google
|
chromium
|
bitfield11
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield11.C
| 203 |
utf_8
|
60e79aef553bffd7cb5b1c983d5960a8
|
// Make sure that digest_init converts to the declared type of the
// bitfield, not just the lowered type.
enum E { EA, EB };
struct A { E e: 8; };
A a = { 0 }; // { dg-error "invalid conversion" }
|
google
|
chromium
|
dynamic1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/dynamic1.C
| 198 |
utf_8
|
eb10fe6db1351b178c1c1068e9806fed
|
// PR c++/10385
// { dg-do compile }
struct A
{
void foo();
};
A& bar();
void baz()
{
dynamic_cast<A&>( bar().foo ); // { dg-error "cannot dynamic_cast" }
}
|
google
|
chromium
|
op3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/op3.C
| 96 |
utf_8
|
abda548f6cf197b5d004afe0b4fa5557
|
// PR c++/22256
struct node { int* operator int*(); }; // { dg-error "return type specified" }
|
google
|
chromium
|
ptrmem3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem3.C
| 1,145 |
utf_8
|
1896de082df820f0dcb7e67fe47949ca
|
// { dg-do compile }
// Assorted pointer to member function static cast tests.
struct A { int f (); };
struct B : A { int f (); };
struct P : A { int f (); };
struct V { int f (); };
struct D : B, virtual V, private P { int f (); };
// Valid static casts.
int (B::*p1)() = static_cast<int (B::*)()>(&D::f);
int (D::*p2)() = static_cast<int (D::*)()>(&B::f);
// Virtual base class.
int (V::*p3)() = static_cast<int (V::*)()>(&D::f); // { dg-error "" }
int (D::*p4)() = static_cast<int (D::*)()>(&V::f); // { dg-error "" }
// Inaccessible base class.
int (P::*p5)() = static_cast<int (P::*)()>(&D::f); // { dg-error "" }
int (D::*p6)() = static_cast<int (D::*)()>(&P::f); // { dg-error "" }
// Ambiguous base class.
int (A::*p7)() = static_cast<int (A::*)()>(&D::f); // { dg-error "" }
int (D::*p8)() = static_cast<int (D::*)()>(&A::f); // { dg-error "" }
// Attempts to change member type.
float (B::*p13)() = static_cast<float (B::*)()>(&D::f); // { dg-error "" }
float (D::*p14)() = static_cast<float (D::*)()>(&B::f); // { dg-error "" }
|
google
|
chromium
|
ptrmem5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem5.C
| 1,115 |
utf_8
|
626164a31d44e2553076ebfa89823d12
|
// { dg-do compile }
// Assorted pointer to member function c-style cast tests.
struct X {};
struct A { int f (); };
struct B : A { int f (); };
struct P : A { int f (); };
struct V { int f (); };
struct D : B, virtual V, private P { int f (); };
// Accessible, non-virtual, non-ambiguous base clas.
int (B::*p1)() = (int (B::*)())&D::f;
int (D::*p2)() = (int (D::*)())&B::f;
// Virtual base class.
int (V::*p3)() = (int (V::*)())&D::f; // { dg-error "" }
int (D::*p4)() = (int (D::*)())&V::f; // { dg-error "" }
// Inaccessible base class.
int (P::*p5)() = (int (P::*)())&D::f;
int (D::*p6)() = (int (D::*)())&P::f;
// Ambiguous base class.
int (A::*p7)() = (int (A::*)())&D::f; // { dg-error "" }
int (D::*p8)() = (int (D::*)())&A::f; // { dg-error "" }
// Attempts to change member type allowed via reinterpret_cast.
float (B::*p13)() = (float (B::*)())&D::f;
float (D::*p14)() = (float (D::*)())&B::f;
// Conversion via unrelated classes allwed via reinterpret_cast.
int (X::*p15)() = (int (X::*)())&D::f;
|
google
|
chromium
|
ptrmem7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem7.C
| 709 |
utf_8
|
0fe129d5222cc52f6d9f59e2a4ccd0de
|
// { dg-do compile }
// Assorted pointer to member function implicit cast tests.
struct A { int f (); };
struct B : A { int f (); };
struct P : A { int f (); };
struct V { int f (); };
struct D : B, virtual V, private P { int f (); };
// Valid.
int (D::*p1)() = &B::f;
// Derived class.
int (B::*p2)() = &D::f; // { dg-error "" }
// Virtual base class.
int (D::*p3)() = &V::f; // { dg-error "" }
// Inaccessible base class.
int (D::*p4)() = &P::f; // { dg-error "" }
// Ambiguous base class.
int (D::*p5)() = &A::f; // { dg-error "" }
// Different member type.
float (D::*p6)() = &B::f; // { dg-error "" }
|
google
|
chromium
|
op4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/op4.C
| 343 |
utf_8
|
7fc0616b77be1d282a71cb29e276be55
|
/* PR c++/26698 */
/* { dg-do "compile" } */
struct X {
int x;
X (int i = 0) : x (i) {}
operator X& (void) const {
return *(new X);
}
};
void add_one (X & ref) { /* { dg-error "in passing argument" } */
++ ref.x;
}
void foo() {
X const a (2);
add_one(a); /* { dg-error "invalid initialization of reference of type" } */
}
|
google
|
chromium
|
op1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/op1.C
| 133 |
utf_8
|
6c0d033c15abd71959655beebc0c3522
|
class C
{
template<typename U>
operator U();
};
int fn (C c)
{
}
|
google
|
chromium
|
dr195-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/dr195-1.C
| 885 |
utf_8
|
424f02c389b9f1fb60fa25d7cda32717
|
// { dg-options "" }
// DR 195 will allow conversions between function and object pointers
// under some circumstances. It is in drafting, so we don't implement
// it (yet).
// this checks we are silent when not being pedantic.
typedef void (*PF)(void);
typedef void *PV;
typedef int *PO;
void foo ()
{
PF pf;
PV pv;
PO po;
/* the following two will almost definitly be ok with 195. */
pf = reinterpret_cast <PF>(pv);
pv = reinterpret_cast <PV>(pf);
/* the following two might or might not be ok with 195. */
pf = reinterpret_cast <PF>(po);
po = reinterpret_cast <PO>(pf);
/* These will never be ok, as they are implicit. */
pv = pf; // { dg-error "invalid conversion" "" }
pf = pv; // { dg-error "invalid conversion" "" }
}
|
google
|
chromium
|
const3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/const3.C
| 79 |
utf_8
|
8dae0b4264c4a22a22f3c8abe5fbdf3b
|
// PR c++/18177
void foo()
{
X; // { dg-error "" }
const_cast<int&>(X);
}
|
google
|
chromium
|
access1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/access1.C
| 294 |
utf_8
|
f0aed431ce3357281e21fdd3e10a7644
|
// PR c++/38579
struct P
{
protected:
P() {}
P(const P&) {}
};
struct B : protected P
{
B() {}
};
struct C : public P
{
// C can access P's copy ctor, but can't convert b to const P&.
C(const B& b) : P(b) {} // { dg-error "inaccessible base" }
};
void foo()
{
B b;
C c(b);
}
|
google
|
chromium
|
bitfield5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield5.C
| 220 |
utf_8
|
5b834a111d6345f96efbf3c3d5bdaa5e
|
// PR c++/27506
enum EBorderStyle
{
BNATIVE, BHIDDEN
};
struct BorderValue
{
enum EBorderStyle style:8;
};
enum EBorderStyle f(const struct BorderValue *border)
{
return border ? border->style : BNATIVE;
}
|
google
|
chromium
|
bitfield8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield8.C
| 487 |
utf_8
|
df929a9deae2fb3db69b7347b27518fa
|
// PR c++/35056
// { dg-do compile }
// { dg-options "-O2" }
enum EBorderStyle { bla = 1 };
inline bool compare_ref(const unsigned int &t, const EBorderStyle &u)
{ return t == u; }
inline bool compare_val(const unsigned int t, const EBorderStyle u)
{ return t == u; }
struct S {
unsigned m_style : 4;
};
void call_ref (S *s, EBorderStyle v)
{ if (!compare_ref(s->m_style, v)) s->m_style = v; }
void call_val (S *s, EBorderStyle v)
{ if (!compare_val(s->m_style, v)) s->m_style = v; }
|
google
|
chromium
|
simd2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/simd2.C
| 330 |
utf_8
|
8e41381be792deb70891ea9cc1764f4a
|
/* { dg-do compile } */
/* Test generic operations on vectors. */
int __attribute__((vector_size(16))) a, b, c;
int __attribute__((vector_size(8))) d;
void foo()
{
a = b ^ c;
a = b + c;
a = b - c;
a = b * c;
a = b / c;
a = -b;
a = d + b; /* { dg-error "invalid operands to binary +" } */
}
|
google
|
chromium
|
ptrmem4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem4.C
| 1,260 |
utf_8
|
17ad39eaf20adaa0ed0d05ef893ab3e3
|
// { dg-do compile }
// Assorted pointer to data member c-style cast tests.
struct X {};
struct A { int x; };
struct B : A { int x; };
struct P : A { int x; };
struct V { int x; };
struct D : B, virtual V, private P { int x; };
// Accessible, non-virtual, non-ambiguous base clas.
int B::*p1 = (int B::*)&D::x;
int D::*p2 = (int D::*)&B::x;
// Virtual base class.
int V::*p3 = (int V::*)&D::x; // { dg-error "" }
int D::*p4 = (int D::*)&V::x; // { dg-error "" }
// Inaccessible base class.
int P::*p5 = (int P::*)&D::x;
int D::*p6 = (int D::*)&P::x;
// Ambiguous base class.
int A::*p7 = (int A::*)&D::x; // { dg-error "" }
int D::*p8 = (int D::*)&A::x; // { dg-error "" }
// Valid conversions which increase cv-qualification.
const int B::*p9 = (const int B::*)&D::x;
const int D::*p10 = (const int D::*)&B::x;
// Valid conversions which decrease cv-qualification.
int B::*p11 = (int B::*)p10;
int D::*p12 = (int D::*)p9;
// Attempts to change member type allowed via reinterpret_cast.
float B::*p13 = (float B::*)&D::x;
float D::*p14 = (float D::*)&B::x;
// Conversion via unrelated classes allwed via reinterpret_cast.
int X::*p15 = (int X::*)&D::x;
|
google
|
chromium
|
op5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/op5.C
| 292 |
utf_8
|
e931274865053d8a40492868844d5c08
|
// Origin: PR c++/36407
// { dg-do compile }
struct A
{
A (const A&);
};
struct B
{
operator A&();
};
void
foo (const B& b)
{
const A a = b; // { dg-error "conversion from 'const B' to non-scalar type 'const A' requested" }
}
|
google
|
chromium
|
bitfield3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield3.C
| 235 |
utf_8
|
be810813d630f0dd9802ec2a447ebbae
|
// PR c++/16376
// { dg-do run }
int main(void){
struct bits {
unsigned int ui3 : 3;
} bits;
int i = -1; /* is a very large positive number as unsigned */
bits.ui3 = 1u;
if( bits.ui3 < i )
return 1;
return 0;
}
|
google
|
chromium
|
const1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/const1.C
| 97 |
utf_8
|
b0e427443037919ee45a88d886f4f4f9
|
// PR c++/14211
void f(char *str) {
char *& m = const_cast<char *>(str); // { dg-error "" }
}
|
google
|
chromium
|
simd1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/simd1.C
| 827 |
utf_8
|
3970220dda674d50ae07f085d355bff3
|
/* { dg-do compile } */
/* Test overload resolution of vector types.
From Janis Johnson and Paolo Bonzini, based on PR/16882 */
#define vector __attribute__((vector_size(16)))
vector signed int vld (int a1, const vector signed int *a2) { return *a2; } /* { dg-message "vld" } */
vector signed short vld (int a1, const vector signed short *a2) { return *a2; } /* { dg-message "vld" } */
extern int i;
extern vector signed short vss;
extern vector signed char *vscp;
extern vector signed short *vssp;
extern const vector signed short *cvssp;
void foo ()
{
vss = vld(i, vscp); /* { dg-error "no matching function for call" } */
vss = vld(i, vssp);
vss = vld(i, cvssp);
}
/* Ignore a warning that is irrelevant to the purpose of this test. */
/* { dg-prune-output ".*GCC vector returned by reference.*" } */
|
google
|
chromium
|
simd3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/simd3.C
| 528 |
utf_8
|
8c47863d6710260a7e45023122628b67
|
/* { dg-do compile } */
typedef int myint;
float __attribute__((vector_size(16))) b;
int __attribute__((vector_size(16))) d;
myint __attribute__((vector_size(16))) d2;
unsigned int __attribute__((vector_size(16))) e;
void foo()
{
b + d; /* { dg-error "invalid operands to binary" } */
d += e; /* { dg-message "use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts.*cannot convert 'unsigned int __vector__' to 'int __vector__' in assignment" } */
d2 += d;
}
|
google
|
chromium
|
dr195
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/dr195.C
| 1,008 |
utf_8
|
ef561373a484d0cfc492aef62fb42418
|
// DR 195 will allow conversions between function and object pointers
// under some circumstances. It is in drafting, so we don't implement
// it (yet).
// This checks we warn when being pedantic.
typedef void (*PF)(void);
typedef void *PV;
typedef int *PO;
void foo ()
{
PF pf;
PV pv;
PO po;
/* the following two will almost definitly be ok with 195. */
pf = reinterpret_cast <PF>(pv); // { dg-warning "casting between" "" }
pv = reinterpret_cast <PV>(pf); // { dg-warning "casting between" "" }
/* the following two might or might not be ok with 195. */
pf = reinterpret_cast <PF>(po); // { dg-warning "casting between" "" }
po = reinterpret_cast <PO>(pf); // { dg-warning "casting between" "" }
/* These will never be ok, as they are implicit. */
pv = pf; // { dg-error "invalid conversion" "" }
pf = pv; // { dg-error "invalid conversion" "" }
}
|
google
|
chromium
|
bitfield4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield4.C
| 210 |
utf_8
|
108dbe59480526dc6ba867064aa94fd0
|
// PR c++/27292
enum ColorRole
{
WindowText, Button
};
struct QPalette {
ColorRole bg_role:8;
bool hasBackground();
};
bool
QPalette::hasBackground ()
{
return (ColorRole (bg_role) != WindowText);
}
|
google
|
chromium
|
void1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/void1.C
| 130 |
utf_8
|
7a062897a2b4fb8f55640e4a532239dd
|
// PR c++/27422
// { dg-do compile }
void foo(void i); // { dg-error "incomplete type|invalid use" }
void bar() { foo(0); }
|
google
|
chromium
|
ambig1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/ambig1.C
| 171 |
utf_8
|
cae83e7bca15183b3b346f9a00467f2c
|
// PR c++/19787
struct H {
operator char(); // { dg-message "note" }
operator short(); // { dg-message "note" }
};
int const& ref = H(); // { dg-error "ambiguous" }
|
google
|
chromium
|
cond1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/cond1.C
| 165 |
utf_8
|
3a1a08be0e7ef48d24c3effabe0bc96f
|
// PR c++/9440
struct A {
explicit A(int = 0);
A(const A&);
operator int() const;
};
A
bar(bool b, const A& a)
{
return (b ? A() : a);
}
|
google
|
chromium
|
cond2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/cond2.C
| 152 |
utf_8
|
e588675f14c4bd6919f2de257b165dee
|
// PR c++/10245
struct X {};
struct Y {
Y ();
operator X () const;
private:
Y (const Y &);
};
Y y;
void foo() {
X x = (1 ? Y() : Y());
}
|
google
|
chromium
|
reinterpret2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/reinterpret2.C
| 52 |
utf_8
|
da446c68ad3e26a27f1f02cfb80bb439
|
bool b;
void f() {
reinterpret_cast<void*>(b);
}
|
google
|
chromium
|
to-virtual-base-1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/to-virtual-base-1.C
| 306 |
utf_8
|
a3a3822acc6c0ae0b1c800209c7c3369
|
struct A {
virtual void f(const A* a) = 0;
};
struct B : virtual A {
virtual void f(const A* a);
};
void B::f(const A* a)
{
static_cast<const B&>(*a); // { dg-error "" }
}
|
google
|
chromium
|
ptrmem8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem8.C
| 334 |
utf_8
|
aeedda629d126c8574002931dd6b1e15
|
// { dg-do run }
// Test for proper conversion of null pointers to data members.
struct B1 {
int x;
};
struct B2 {
int x;
};
struct D : B1, B2 {
int x;
};
int main ()
{
int D::*pd = 0;
int B2::*pb2 = 0;
return pd != pb2;
}
|
google
|
chromium
|
bitfield1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield1.C
| 234 |
utf_8
|
f1b5334044ded17fb9949549b0502764
|
// { dg-do run }
// { dg-options "-w" }
enum E { a, b = 1LL << 48 };
struct S {
E e : 3;
};
S s;
int main () {
if (sizeof (E) != sizeof (long long))
return 1;
if (sizeof (s.e + 3) != sizeof (long long))
return 2;
}
|
google
|
chromium
|
nullptr2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/nullptr2.C
| 183 |
utf_8
|
48dde4679a9c2fd89e9213a130223e9e
|
/* Test for enumeration as NULL pointer constant. */
/* PR c++/14644 */
/* { dg-do compile } */
enum { NULL = 0 };
void *p = 0;
void *q = NULL; // { dg-error "cannot convert" }
|
google
|
chromium
|
cast1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/cast1.C
| 361 |
utf_8
|
8fd4aac31847c0c9e16276ac87169301
|
// PR c++/10841
int main() {
class Base {
public:
int i, j, k;
void f(); };
class Derived : private Base {
public:
int m, n, p;
void g();
};
Derived derived;
Base &base = (Base &)derived;
(int Base::*)&Derived::n;
(int Derived::*)&Base::j;
(void (Base::*)(void))&Derived::g;
(void (Derived::*)(void))&Base::f;
}
|
google
|
chromium
|
cond3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/cond3.C
| 265 |
utf_8
|
da146cc2c8fcbbcd080e02f0e3f733df
|
// PR c++/9537
class String
{
public:
String();
String( char *str );
operator char *();
};
const String operator+( String s1, String )
{
return s1;
}
String valGlue(const String before)
{
String ret;
return false ? ret : before + before;
}
|
google
|
chromium
|
reinterpret1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/reinterpret1.C
| 101 |
utf_8
|
6e5e81ebfb94f64d88135e578c526065
|
// PR c++/15076
struct Y { Y(int &); };
int v;
Y y1(reinterpret_cast<int>(v)); // { dg-error "" }
|
google
|
chromium
|
bitfield7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield7.C
| 202 |
utf_8
|
7d23de731dd222bf440177edc7086be2
|
// PR c++/33984
// { dg-do compile }
struct S
{
unsigned int bar : 3;
} s;
int foo (unsigned int &);
int foo (double);
int
main ()
{
return foo (s.bar); // { dg-error "cannot bind bitfield" }
}
|
google
|
chromium
|
reinterpret3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/reinterpret3.C
| 84 |
utf_8
|
d4e80e3dcc4416f9be4b4b9e390904bd
|
struct S {};
S s;
void f() {
reinterpret_cast<const S>(s); // { dg-error "" }
}
|
google
|
chromium
|
ptrmem1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem1.C
| 122 |
utf_8
|
23830a13c326c99bae67e56e30ebc0b4
|
struct S {};
void f (int S::*const*);
typedef int I;
void f (I S::*const*);
void g() {
int S::*const* p;
f(p);
}
|
google
|
chromium
|
ptrmem6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem6.C
| 824 |
utf_8
|
51b173d4a14b312b2489d71f89effb18
|
// { dg-do compile }
// Assorted pointer to data member implicit cast tests.
struct A { int x; };
struct B : A { int x; };
struct P : A { int x; };
struct V { int x; };
struct D : B, virtual V, private P { int x; };
// Valid.
int D::*p1 = &B::x;
// Derived class.
int B::*p2 = &D::x; // { dg-error "" }
// Virtual base class.
int D::*p3 = &V::x; // { dg-error "" }
// Inaccessible base class.
int D::*p4 = &P::x; // { dg-error "" }
// Ambiguous base class.
int D::*p5 = &A::x; // { dg-error "" }
// Increases cv-qualification.
const int D::*p6 = &B::x;
// Decreases cv-qualification.
int D::*p7 = static_cast<const int D::*>(&D::x); // { dg-error "" }
// Different member type.
float D::*p8 = &B::x; // { dg-error "" }
|
google
|
chromium
|
memfn1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/memfn1.C
| 242 |
utf_8
|
a0a917766bdefb909863e17a7a3e001b
|
// PR c++/36334
struct X
{
typedef int* foobar();
static void foo(foobar&);
};
void X::foo(foobar&)
{
}
struct Y : public X
{
static foobar bar;
static void foo();
};
void Y::foo()
{
X::foo(bar);
}
int* Y::bar()
{
return 0;
}
|
google
|
chromium
|
bitfield6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield6.C
| 126 |
utf_8
|
3ab5d3b674f60cdf43355937cdc5e7ba
|
// PR c++/27471
struct A { unsigned a:8; };
extern void b(unsigned char);
void breakme (A f)
{
b((unsigned char) f.a);
}
|
google
|
chromium
|
nullptr1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/nullptr1.C
| 252 |
utf_8
|
c30de2400829d5e6176f6a8e297cba06
|
/* Test for overflow in NULL pointer constant. */
/* { dg-do compile } */
#include <limits.h>
void *p = 0;
void *q = 0 * (INT_MAX + 1); // { dg-error "invalid conversion" }
// { dg-warning "integer overflow in expression" "" { target *-*-* } 8 }
|
google
|
chromium
|
bitfield2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield2.C
| 82 |
utf_8
|
4f08e43e1ee5b1ab9782df9a7152620c
|
// PR c++/27292
struct A
{
int i : 8;
};
bool foo(A a)
{
return int(a.i);
}
|
google
|
chromium
|
op2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/op2.C
| 345 |
utf_8
|
3691f2fae514386b7e94bd8db99acd68
|
// PR c++/13907
struct A {
operator int & ();
operator const int & () const;
};
void f(int &);
void f(const int &);
int main() {
const A x = A();
f(x);
}
|
google
|
chromium
|
ptrmem9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem9.C
| 496 |
utf_8
|
50b8165a65270e03397cfb7a9f9f5433
|
// { dg-do compile }
// Test implicit conversion of pointers to member functions appearing as
// operands of the equality operators.
struct B { };
struct BV { };
struct D : B, virtual BV { };
struct C { };
void f ()
{
void (D::*pd) () = 0;
void (B::*pb) () = 0;
void (BV::*pbv) () = 0;
void (C::*pc) () = 0;
pd == pb;
pd == pbv; // { dg-error "" }
pd == pc; // { dg-error "" }
}
|
google
|
chromium
|
enum1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/enum1.C
| 221 |
utf_8
|
2e281007b9998371bac78412c4e9f5c0
|
// { dg-do run }
// { dg-options "-O2 -finline-functions" }
enum E { V = 1 };
static const E E_MIN = V;
static const E E_MAX = V;
bool valid(E v) { return v >= E_MIN && v <= E_MAX; }
int main() { return valid(E(2)); }
|
google
|
chromium
|
simd4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/simd4.C
| 1,090 |
utf_8
|
cbf6c39df44754b216a83ab9d8de5418
|
// PR c++/29734
// { dg-do compile }
// { dg-options "" }
int t;
float u;
int __attribute__((vector_size (8))) v;
float __attribute__((vector_size (8))) w;
int b[10];
void
foo ()
{
b[t];
b[u]; // { dg-error "invalid types" }
b[v]; // { dg-error "invalid types" }
b[w]; // { dg-error "invalid types" }
t[b];
u[b]; // { dg-error "invalid types" }
v[b]; // { dg-error "invalid types" }
w[b]; // { dg-error "invalid types" }
new int[t];
new int[u]; // { dg-error "new-declarator must have integral" }
new int[v]; // { dg-error "new-declarator must have integral" }
new int[w]; // { dg-error "new-declarator must have integral" }
switch (t) { default: break; }
switch (u) { default: break; } // { dg-error "switch quantity not an integer" }
switch (v) { default: break; } // { dg-error "switch quantity not an integer" }
switch (w) { default: break; } // { dg-error "switch quantity not an integer" }
t = ~t;
u = ~u; // { dg-error "wrong type argument to bit-complement" }
v = ~v;
w = ~w; // { dg-error "wrong type argument to bit-complement" }
}
|
google
|
chromium
|
memfn2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/conversion/memfn2.C
| 145 |
utf_8
|
d63b302b1a2b008c04cb961af27de8c7
|
// PR c++/37646
struct A
{
void foo();
void bar(int i)
{
void (*p)() = i ? foo : foo; // { dg-error "invalid use of member" }
}
};
|
google
|
chromium
|
sizeof8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sizeof8.C
| 191 |
utf_8
|
84c8e28b3b15370829046813c1fbb7b3
|
// { dg-do compile }
// PR c++/11406: ICE
template <int> struct S{};
template <int N> S<sizeof(new double[N])> f() {}
template S<sizeof(void*)> f<2>();
|
google
|
chromium
|
typename10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typename10.C
| 456 |
utf_8
|
13cebd5e928102ca67a8d6b4960714fb
|
// { dg-do compile }
// PR 27787. Too eager to resolve a typename
template<typename X>
struct x
{
template<typename Y>
struct y
{
typedef Y type;
};
};
template<typename A>
struct a : x<A>
{
template<typename B>
typename a::template y<B>::type f(B);
};
|
google
|
chromium
|
enum4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/enum4.C
| 118 |
utf_8
|
118d8ffd607a579db3ddbc9662179566
|
// PR c++/18020
template <typename> struct bar {
enum {
e1 = 1,
e2 = ~e1
};
};
template struct bar<int>;
|
google
|
chromium
|
crash35
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash35.C
| 194 |
utf_8
|
8df742184e3299064aab4742d5bbf80b
|
// PR c++/20463
// { dg-do compile }
template <typename T> struct C; // { dg-error "declaration" }
template <typename T> void C<T>::f() // { dg-error "invalid|template" }
{
const foo bar;
}
|
google
|
chromium
|
friend11
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend11.C
| 341 |
utf_8
|
c1eab5b806b63596b0fa26a471273823
|
/* PR c++/53 */
/* { dg-do compile } */
template <class T>
struct A {
template <class U> class B;
// Did not compile with gcc-2.95.2 (linux i686) :-(
template <class S> template <class U> friend class A<S>::B;
};
template <class S> template <class U> class A<S>::B {
};
int main(){
A<double>::B<double> ab;
return 0;
}
|
google
|
chromium
|
access6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access6.C
| 421 |
utf_8
|
3f2e5ae210f767c1589637afbcf45353
|
// { dg-do compile }
// PR c++/8389
// Access control ICE for typename during instantiation and name mangling
template <class> class Base {
protected:
typedef int Type;
};
template <class T> struct Derived : public Base<T> {
typedef typename Base<T>::Type Type;
template <class Arg> void f(Type = Type()) {}
};
template void Derived<char>::f<int> (Type);
|
google
|
chromium
|
using5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/using5.C
| 379 |
utf_8
|
730dbbdbfc73d70df6d68467f8af3c39
|
// { dg-do compile }
// PR 9447. further test cases for dependent using decl
template <typename T> struct Base;
template <typename T> struct Derived : public Base<T> {
using Base<T>::i;
Derived() { i; }
int get_i() { return i.f(); }
};
|
google
|
chromium
|
ptrmem14
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem14.C
| 126 |
utf_8
|
372af7481dbb814fd59792b6160a671e
|
// PR c++/15875
struct A
{
void foo();
};
template<int> void bar()
{
typedef void (A::*fptr)();
fptr ptr = &A::foo;
}
|
google
|
chromium
|
koenig8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/koenig8.C
| 224 |
utf_8
|
331e9bd8d23757608f4687c51ab1c460
|
// PR c++/40740
template<class T>
T addsome(T v) {
return v+1;
}
int addsome(int v) {
return v+2;
}
int main() {
int i = 0;
if (addsome(i) != 2)
return 1;
if (addsome<>(i) != 1)
return 2;
return 0;
}
|
google
|
chromium
|
crash54
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash54.C
| 129 |
utf_8
|
dc113f6f407f869c16ea1bfd3923f2c0
|
//PR c++/28269
template<int> struct A;
struct __attribute__((unused)) A<0<; // { dg-error "template argument|unqualified-id" }
|
google
|
chromium
|
explicit-instantiation2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/explicit-instantiation2.C
| 214 |
utf_8
|
6335a6cb9fd88717c1c31d2bc8b80c3e
|
// Bug 10968: implicit instantiation overrides explicit instantiation
// { dg-final { scan-assembler "_Z1fIiET_S0_" } }
template <class T> T f (T t) { return t; }
inline void g () { f (4); }
template int f (int);
|
google
|
chromium
|
debug1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/debug1.C
| 305 |
utf_8
|
884d79169a3e45dac3ed1c397aba8ac9
|
// PR c++/40274
// { dg-options "-g" }
template <class T> struct valuelist_types
{
struct null { };
template <T V, class next=null> struct list { };
};
template <unsigned D> void foo()
{
typename valuelist_types<unsigned>::template list<D> v;
}
void bar()
{
valuelist_types<unsigned>::list<2> v;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.