++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
This program:
template
bool equals(X x, Y y) {
return (x == y);
}
int main() {
const char* p = nullptr;
equals(p, nullptr);
}
When compiled as:
$ g++ -std
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Here's a short example:
template
struct X
{ };
template class A, typename T>
struct Y
{ };
template cl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83542
--- Comment #1 from Barry Revzin ---
This slightly different example:
template
struct list { };
template
void foo(list, list, void(*)(T..., U))
{ }
void f(int, int) { }
int main()
{
foo(list{}, list{}, );
}
fails with a different
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
This example fails to compile:
template
struct list { };
template
void foo(list, list, void(*)(T..., U
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
This example compiles:
template
void foo(Args..., T ) { }
int main() {
foo(0);
}
with Args deducing as empty
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Example from StackOverflow (https://stackoverflow.com/q/47606810/2069064):
template<void(*)()> struct A{};
in
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider this example (reduced from SO:
https://stackoverflow.com/q/47261553/2069064)
template
struct
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider this example:
struct Foo {
int n;
};
struct Bar {
double n;
bool b;
};
template
struct Baz : public T {
char pad[8 - sizeof(T)];
};
int main
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80985
Barry Revzin changed:
What|Removed |Added
CC||barry.revzin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82632
--- Comment #1 from Barry Revzin ---
Actually, I'm pretty sure that gcc is correct here while this is a clang bug
for rejecting. The copy deduction candidate is more specialized, which is
preferred first over the deduction-guide.
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Minimal example courtesy of STL from
https://bugs.llvm.org/show_bug.cgi?id=34970:
template struct IsSame {
static constexpr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71205
Barry Revzin changed:
What|Removed |Added
CC||barry.revzin at gmail dot com
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
If we try to make the template-name of the deduction guide a type-parameter,
courtesy of W.F. on SO (https://stackoverflow.com/q/46624005/2069064):
template
struct Foo {
Foo(T
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
This example compiles:
template class P> struct X { };
template <auto*> struct A { };
int main() {
X();
}
: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
This example fails with all versions of gcc currently:
struct X {
X() = delete;
};
template
concept bool C
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
struct B { };
struct D : B { int i; };
int main() {
auto [i] = D{};
}
On gcc 7.2, this fails with:
sb.cxx:5:10: error: cannot decompose class type āDā: both
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Example slightly reduced from http://lists.isocpp.org/core/2017/08/2827.php:
template
struct is_same;
struct
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
>From StackOverflow (https://stackoverflow.com/q/45843428/2069064), a reduced
example:
#include
template
struct opt {
opt() { }
opt(opt const&
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider this reduced example taken from StackOverflow
(https://stackoverflow.com/questions/45602368/correct-behavior-of-built-in-operator-candidates-of-the-overload-resolution-in-t):
struct
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider this example, simplified from
https://stackoverflow.com/q/45195890/2069064:
template
struct C {
C(T );
};
template
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
>From StackOverflow (https://stackoverflow.com/q/44698195/2069064), this static
assert trips:
#include
#include
int main() {
a
: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
In the following example:
struct S;
struct T {
#ifdef BUG
T(S const& );
#else
T(S& );
#endif
};
struct S {
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80943
--- Comment #1 from Barry Revzin ---
Sorry, it's a bug, but not for the reasons I cited. Both T t(s) and T t{s}
should consider constructors - which should find T(S const& ) and T(T&& ) by
way of the conversion function. But the former is an
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider this example:
#include
struct S;
struct T {
T() = default;
T(S const& ) { std::cout << "1\n&q
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider this example:
#ifdef VARIADIC
template
constexpr int foo(Us... ) { return 1
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
>From StackOverflow (http://stackoverflow.com/q/44015848/2069064), this code:
#include
#include
struct S {
S() { std::printf("DEF "); } /
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Here's a simplifed example of overloading taking from StackOverflow question
http://stackoverflow.com/q/43982799/2069064:
template
struct
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
>From this StackOverflow question: http://stackoverflow.com/q/43894619/2069064
This example fails:
#include
struct Point { int x, y; };
int main()
{
const auto [x
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Minimal example:
template struct is_same { static constexpr bool value =
false; };
template struct is_same<T, T> { static constexpr bool value = true;
};
int main() {
int
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
The following example:
#include
#include
#include
template
struct value { };
template
struct value_sequence { };
template
constexpr value_sequence<As..., Bs...> op
: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
In this example:
template struct pack { };
// (1)
template
void foo(pack ) { }
// (2)
template
void foo(pack&l
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
This example fails to compile on the marked line - gcc requires me to write
result.template foo(), which
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
The following fails to compile on any version of gcc (or clang) I tried:
#include
template struct X;
template struct X { };
template struct Y { X x; };
template
std
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
This example:
struct A {
template
void operator==(T const& ) const;
template
fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78180
--- Comment #8 from Barry Revzin ---
-D_GLIBCXX_USE_CXX11_ABI=0 doesn't matter. It's just that I'd compiled google
benchmark with 4.8, and then wanted to test this behavior with 5.4 and 6.2. It
has no impact on the generated assembly as far as I
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78180
--- Comment #1 from Barry Revzin ---
Upon further investigation, all of the difference is in benchmark comes from
the initialization of the raw array versus std::array. For some reason, in the
two examples, the two containers are initialized
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Here is a complete benchmark comparing a bunch of simple operations on a
std::array<int64_t, 128> vs a int64
: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
#include
struct comp {
bool operator()(int i, int j) const {
return i < j;
}
using is_transpar
ty: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
#include
int main() {
std::unique_ptr p;
p.reset(new char[1]);
}
fails to compile with due to reset invoking swap on two different types.
H
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Can't come up with a more reduced example, but consider this code that makes a
Y combinator version of factorial and calls it:
#include
#include
template
struct y_combinator
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
In this example:
#include
struct X {
X(std::initializer_list) { std::cout << '1'; }
X(X const& ) { std::
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72842
--- Comment #4 from Barry Revzin ---
I'll just email. Instantiating foo creates a function template with a
non-type template parameter of type void. That's not an allowed type of a
non-type template parameter, so I think it should be ill-formed.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72842
--- Comment #2 from Barry Revzin ---
This non-dependent version:
template void bar() { }
fails to compile, even if we never call bar(), even if we wanted to call it
with an empty pack.
foo in the original example is this same thing with an
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
The following compiles on gcc (and clang), across all versions I've tried:
template
void foo() { }
int main() {
foo();
}
But void isn't a valid non-type template
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
This may not be totally minimal, but the following code:
#include
struct A {};
template
struct B : A { };
template struct typelist {};
template struct tag { using type = T
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
gcc 5.3.0 compiles this code:
struct B {
B() = default;
explicit B(B const& ) { }
};
struct D : B { };
int main() {
try {
thr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41437
Barry Revzin changed:
What|Removed |Added
CC||barry.revzin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70141
Barry Revzin changed:
What|Removed |Added
CC||barry.revzin at gmail dot com
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
The following code fails to compile, with an error about y not being in scope:
struct X {
X() noexcept(noexcept(y+1)) { }
int y;
};
int main() { }
However
: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
The following fragment compiles on g++ 5.3.0:
struct X { };
namespace foo {
template
void bar() { T{} <
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67943
--- Comment #1 from Barry Revzin ---
Actually, according to [class.base.access], this is valid code. Unless CWG 472
gets adopted I guess. In any case, disregard - my bad.
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
gcc 5.2 compiles the following:
struct Base { };
struct Derived : protected Base { };
struct Derived2 : public
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider this example (also in SO question
http://stackoverflow.com/q/32335523/2069064):
#include
template
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
In the following code, A is neither movable nor copyable, and B has an A:
#include utility
struct A {
A() { }
A(A const
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67342
--- Comment #3 from Barry Revzin barry.revzin at gmail dot com ---
Thanks! I was pretty sure I was wrong but couldn't figure out why.
Barry
On Mon, Aug 24, 2015, 2:29 PM redi at gcc dot gnu.org
gcc-bugzi...@gcc.gnu.org wrote:
https
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
The following code:
struct Value
{
templateclass T
static constexpr T value = 0;
};
templatetypename TValue
struct Something
{
void foo
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
In the following code:
#include tuple
templateint I
struct A {};
templateint I, typename... T
void f(AI, std::tupleT *...) {} // (1)
templatetypename... T
void f
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
The following code:
#include iostream
template typename N
struct A {
template typename T
void
: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider the following:
struct B {};
struct S { explicit operator B(); };
int main() {
B const t(S{});
}
According
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider the following code, courtesy of Belloc
(http://stackoverflow.com/q/31348475/2069064):
struct Outer {
void f() { }
class C { };
class Inner
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58740
Barry Revzin barry.revzin at gmail dot com changed:
What|Removed |Added
CC||barry.revzin
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
The following code fails to compile on gcc 5.1:
#include map
template typename T
struct X {
std::mapint, T* storage = new
++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider this attempt at implementing fmap for optionals in C++:
#include boost/optional.hpp
#include iostream
template typename Func
auto fmap(Func f)
{
return [=](auto arg
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider this code (taken from SO question)
#include iostream
struct A {
template class T operator T***()
{
static_assert
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66108
--- Comment #1 from Barry Revzin barry.revzin at gmail dot com ---
Forgot to add link:
http://stackoverflow.com/questions/30172533/template-argument-type-deduction-by-conversion-operator
: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
From StackOverflow question: http://stackoverflow.com/q/30007692/2069064
Consider the following:
struct Foo{};
int main()
{
Foo a;
auto b{a};
a = b
201 - 266 of 266 matches
Mail list logo