[Bug c++/81952] New: copy elision used when constructor needs to be called

2017-08-23 Thread barry.revzin at gmail dot com
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&

[Bug c++/81975] New: Unpacking two packs via alias erroneously complains about mismatched argument packs

2017-08-24 Thread barry.revzin at gmail dot com
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

[Bug c++/82075] New: structured binding fails with empty base class

2017-09-01 Thread barry.revzin at gmail dot com
++ 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 it and

[Bug c++/82110] New: Concept for default constructing works with new T, not with new T[1]

2017-09-05 Thread barry.revzin at gmail dot com
: 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

[Bug c++/82266] New: [DR150] Allowing more specialized argument than parameter for placeholder

2017-09-19 Thread barry.revzin at gmail dot com
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 struct A { }; int main() { X(); } But here, A is m

[Bug c++/80703] New: Including breaks structured bindings

2017-05-10 Thread barry.revzin at gmail dot com
++ 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

[Bug c++/80767] New: Eager instantiation of member template when not required

2017-05-15 Thread barry.revzin at gmail dot com
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 s

[Bug c++/80804] New: Default constructor improperly invoked in C++1z mode

2017-05-17 Thread barry.revzin at gmail dot com
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 "); } /

[Bug c++/80871] New: Template partial ordering considered non-ambiguous with deduced and non-deduced parameter packs

2017-05-23 Thread barry.revzin at gmail dot com
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

[Bug c++/80943] New: Conversion function selected in list-initialization in C++1z mode

2017-06-01 Thread barry.revzin at gmail dot com
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

[Bug c++/80943] Conversion function selected in list-initialization in C++1z mode

2017-06-01 Thread barry.revzin at gmail dot com
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 exac

[Bug c++/80961] New: Constructor preferred over conversion operator, when should be ambiguous

2017-06-02 Thread barry.revzin at gmail dot com
: 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 {

[Bug c++/81176] New: decltype(auto) yields reference type for structured binding

2017-06-22 Thread barry.revzin at gmail dot com
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

[Bug c++/78623] New: non-dependent name treated as if it were dependent, requiring use of template keyword

2016-11-30 Thread barry.revzin at gmail dot com
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

[Bug c++/78753] New: non-ambiguous overload resolution with function template partial ordering rules

2016-12-09 Thread barry.revzin at gmail dot com
: 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

[Bug c++/79138] New: ICE when trying to do template auto

2017-01-18 Thread barry.revzin at gmail dot com
++ 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 operator+(value_sequence

[Bug c++/79378] New: lambda init-capture adds const

2017-02-04 Thread barry.revzin at gmail dot com
++ 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 { static constexpr bool value = true; }; int main() { int i = 0

[Bug c++/82468] New: ICE with deduction guide template

2017-10-07 Thread 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

[Bug c++/71205] c++14 wrong constructor resolution

2017-10-12 Thread barry.revzin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71205 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug c++/82632] New: copy deduction candidate erroneously preferred over deduction-guide

2017-10-19 Thread barry.revzin at gmail dot com
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

[Bug c++/82632] copy deduction candidate erroneously preferred over deduction-guide

2017-10-20 Thread 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.

[Bug c++/80985] -Wnoexcept-type should not produce a warning for inlined template functions

2017-10-20 Thread barry.revzin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80985 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug c++/82893] New: Bad diagnostic on negative sized array

2017-11-07 Thread barry.revzin at gmail dot com
++ 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

[Bug c++/82980] New: Regression in determination of current instantiation (invalid requirement of template keyword)

2017-11-13 Thread barry.revzin at gmail dot com
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

[Bug c++/83258] New: Rejecting function pointer non-type template parameter without linkage

2017-12-02 Thread barry.revzin at gmail dot com
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 struct A{}; int main() { constexpr auto

[Bug c++/77825] New: return type deduction regression in 7.0

2016-10-03 Thread barry.revzin at gmail dot com
++ 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_combi

[Bug c++/77987] New: unique_ptr reset rejects cv-compatible pointers

2016-10-14 Thread barry.revzin at gmail dot com
: 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. However, this code

[Bug libstdc++/78134] New: set::set lower_bound() for transparent comparator returns const_iterator

2016-10-27 Thread barry.revzin at gmail dot com
: 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

[Bug c++/78180] New: Poor optimization of std::array on gcc 4.8/5.4/6.2 as compared to simple raw array

2016-11-01 Thread barry.revzin at gmail dot com
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 vs a int64_t[128]. I'm

[Bug c++/78180] Poor optimization of std::array on gcc 4.8/5.4/6.2 as compared to simple raw array

2016-11-01 Thread barry.revzin at gmail dot com
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 diff

[Bug tree-optimization/78180] Poor optimization of std::array on gcc 4.8/5.4/6.2 as compared to simple raw array

2016-11-03 Thread barry.revzin at gmail dot com
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

[Bug c++/78291] New: overload resolution prefers non-member operator to member operator when should be ambiguous

2016-11-10 Thread barry.revzin at gmail dot com
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

[Bug c++/78457] New: attempt to instantiate unused template

2016-11-21 Thread barry.revzin at gmail dot com
++ 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

[Bug c++/65994] New: auto deduces object instead of initializer_list

2015-05-03 Thread barry.revzin at gmail dot com
: 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

[Bug c++/66108] New: cv-qualification deducation failure on conversion operator

2015-05-11 Thread barry.revzin at gmail dot com
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 struct A { template operator T***() { static_assert(std::is_same

[Bug c++/66108] cv-qualification deducation failure on conversion operator

2015-05-11 Thread barry.revzin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66108 --- Comment #1 from Barry Revzin --- Forgot to add link: http://stackoverflow.com/questions/30172533/template-argument-type-deduction-by-conversion-operator

[Bug c++/66135] New: trailing return type generic lambda

2015-05-13 Thread barry.revzin at gmail dot com
++ 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 #include template auto fmap(Func f) { return [=](auto arg) -> boost::optional { // **

[Bug c++/66344] New: non-static data member initializer in class template fails to compile

2015-05-30 Thread barry.revzin at gmail dot com
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 template struct X { std::map* storage = new std::map; }; int

[Bug c++/67943] New: Friend declaration applied to base class, leading to allowing access to protected base

2015-10-12 Thread barry.revzin at gmail dot com
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

[Bug c++/67943] Friend declaration applied to base class, leading to allowing access to protected base

2015-10-12 Thread barry.revzin at gmail dot com
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.

[Bug c++/58740] incorrect access check of static base class member in derived template class

2015-07-08 Thread barry.revzin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58740 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug c++/66836] New: inconsistent unqualified lookup for friend declaration

2015-07-10 Thread barry.revzin at gmail dot com
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

[Bug c++/66893] New: disallowed initialization of reference with user-defined conversion function

2015-07-15 Thread barry.revzin at gmail dot com
: 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{}); } Accor

[Bug c++/66914] New: incorrect template partial ordering prefers non-member function instead of being ambiguous

2015-07-17 Thread barry.revzin at gmail dot com
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 template struct A { template void operator+(T const

[Bug c++/67228] New: Template partial ordering failure ambiguous overload

2015-08-15 Thread barry.revzin at gmail dot com
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- In the following code: #include template struct A {}; template void f(A, std::tuple) {} // (1) template void f(A<0>, std::tuple) {} // (2) int main() {

[Bug c++/67248] New: Variable template cannot be used as dependent name

2015-08-17 Thread 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: struct Value { template static constexpr T value = 0; }; template struct Something { void foo() { static_assert(TValue

[Bug c++/67342] New: Ill-formed move constructor ignored in favor of copy constructor

2015-08-24 Thread barry.revzin at gmail dot com
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 struct A { A() { } A(A const&) = de

[Bug c++/67342] Ill-formed move constructor ignored in favor of copy constructor

2015-08-24 Thread barry.revzin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67342 --- Comment #3 from Barry Revzin --- 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://gcc.gnu.org/bugzilla/show_bug.cgi?

[Bug c++/67426] New: Ambiguous overload between different function templates, where one has non-deduced arg

2015-09-01 Thread barry.revzin at gmail dot com
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

[Bug c++/72842] New: non-type template-parameter of type void

2016-08-08 Thread barry.revzin at gmail dot com
++ 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-typ

[Bug c++/72842] non-type template-parameter of type void

2016-08-08 Thread barry.revzin at gmail dot com
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 ex

[Bug c++/72842] non-type template-parameter of type void

2016-08-08 Thread barry.revzin at gmail dot com
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.

[Bug c++/76262] New: list-initialization prefers initializer_list over copy constructor

2016-08-13 Thread barry.revzin at gmail dot com
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&

[Bug c++/99566] New: designated initialization rejects explicit constructor

2021-03-12 Thread barry.revzin at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Reduced from StackOverflow (https://stackoverflow.com/q/66606143/2069064): struct A { explicit A(int); }; struct B { A a; }; A a{10}; // ok B b{.a{10

[Bug c++/99629] New: Misleading diagnostic when looking up rewritten candidate and failing

2021-03-17 Thread barry.revzin at gmail dot com via Gcc-bugs
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/66674463/2069064): #include struct S {}; int operator<=>(S, int) {

[Bug c++/79070] Unhelpful error message for ambiguous type in template parameter

2021-03-29 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79070 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug c++/100037] New: lookup doesn't find class template parameter in default member initializer of forward declared nested class template

2021-04-11 Thread barry.revzin at gmail dot com via Gcc-bugs
: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Issue title is a mouthful, but it's a very n

[Bug c++/100054] New: internal compiler error: in get_nsdmi

2021-04-12 Thread barry.revzin at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Reduced with creduce and then by hand: template struct C { void find() { struct H { C c{}; }; (void)[](auto){ return H{}; }; } }; void f() { C().find

[Bug c++/100054] [11 Regression] internal compiler error: in get_nsdmi

2021-04-12 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100054 --- Comment #2 from Barry Revzin --- In case it helps, here's a different example which on trunk ICEs in get_nsdmi, but on gcc 10.2 and 10.3 ICEs on "unexpected expression '(F)()' of kind implicit_conv_expr" (and is accepted by 10.1) struct F {

[Bug c++/100070] New: Standard library container iterator-pair constructors should check C++20 iterator concepts

2021-04-13 Thread barry.revzin at gmail dot com via Gcc-bugs
Severity: normal 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/67081354/2069064), a user was benchmarking code that

[Bug c++/100084] New: using enum lookup isn't type-only

2021-04-14 Thread barry.revzin at gmail dot com via Gcc-bugs
nt: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- >From Stack Avarflaw (https://stackoverflow.com/q/67096550/2069064): namespace A { enum A {}; }; using namespace A; using enum A; gcc trunk rejects this lookup as ambiguous,

[Bug c++/100084] using enum lookup isn't type-only

2021-04-14 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100084 --- Comment #1 from Barry Revzin --- Also gcc accepts: namespace A { enum A {}; }; using namespace A; using enum A::A; Which, apparently, this one should actually be ambiguous.

[Bug c++/97518] New: Improving static_assert diagnostics

2020-10-21 Thread barry.revzin at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider the following: template struct is_same { static constexpr bool value = false; }; template struct is_same { static constexpr bool value = true; }; template using

[Bug c++/97562] New: NRVO is very fragile (adding an extra scope breaks the optimization)

2020-10-24 Thread barry.revzin at gmail dot com via Gcc-bugs
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider the following (where T is just some type that is trivially copyable but large enough): struct T { char _[24

[Bug c++/97562] NRVO is very fragile (adding an extra scope breaks the optimization)

2020-10-26 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97562 --- Comment #2 from Barry Revzin --- Yep, looks like the same issue to me.

[Bug c++/51242] [C++11] Unable to use strongly typed enums as bit fields

2020-11-08 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51242 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug c++/97934] New: Defaulting <=> breaks other equality operators

2020-11-21 Thread barry.revzin at gmail dot com via Gcc-bugs
ent: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Reduced example: #include struct X { auto operator<=>(X const&) const = default; auto operator==(int i) const; }; bool f(X x) { return x ==

[Bug c++/98071] New: no_unique_address and reusing tail padding

2020-11-30 Thread barry.revzin at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Simple example: struct A { int x; char y; }; template struct B { [[no_unique_address]] T t; bool u; }; static_assert(sizeof(B) == sizeof(A)); The data

[Bug c++/98071] no_unique_address and reusing tail padding

2020-11-30 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98071 --- Comment #1 from Barry Revzin --- On further discussion, since the ABI disallows reusing the tail padding of PODs, sizeof(B) cannot be 8. This is more likely a clang bug.

[Bug c++/98142] New: fstrict-enums optimization applied only for unscoped enums with unfixed underlying type

2020-12-04 Thread barry.revzin at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider this simple example namespace N4 { enum E { A, B, C, D }; bool compare_logical(E x) { return (x

[Bug c++/98142] fstrict-enums optimization applied only for unscoped enums with unfixed underlying type

2020-12-04 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98142 --- Comment #2 from Barry Revzin --- That is a great point. I guess in general this is kind of a scary optimization, since it doesn't seem like it's really a global thing? Perhaps this calls for an attribute? [[gnu::i_promise_on_penalty_of_ub_t

[Bug c++/97195] New: construct_at on a union member is not a constant expression

2020-09-24 Thread barry.revzin at gmail dot com via Gcc-bugs
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- In trying to test adding more constexpr support to std::optional: #include union S { int i; }; constexpr int f() { S s; std

[Bug c++/97285] New: Interaction between no_unique_address and has_unique_object_representations

2020-10-04 Thread barry.revzin at gmail dot com via Gcc-bugs
: normal 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/64195712/2069064): #include struct Empty {}; struct A : public Em

[Bug c++/98706] New: spurious unused-set-but-not-used when a parameter pack is empty

2021-01-16 Thread barry.revzin at gmail dot com via Gcc-bugs
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Short test case: template constexpr auto f(T... ts) { auto id = [](auto x){ return x; }; return (id(ts) + ... + 0

[Bug c++/85428] constexpr pointer equality comparison not considered constant expression

2021-01-31 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85428 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug c++/99091] New: constexpr variable evaluated at runtime

2021-02-13 Thread barry.revzin at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider the following (link to compiler explorer: https://godbolt.org/z/jWsxsK) #include static constexpr auto doy = []{ std::array month_offset{}; for (int m=1; m<

[Bug c++/100322] Switching from std=c++17 to std=c++20 causes performance regression in relationals

2021-04-28 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100322 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug c++/100322] Switching from std=c++17 to std=c++20 causes performance regression in relationals

2021-04-28 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100322 --- Comment #5 from Barry Revzin --- Sorry meant to actually copy the reduction: #include bool compare_count(int a, int b) { return a > b; } bool compare(int a, int b) { return (a <=> b) > 0; } which generates: compare_count(int,

[Bug c++/100639] New: reverse_view::reference erroneously uses iterator_traits::reference instead of iter_reference_t

2021-05-17 Thread barry.revzin at gmail dot com via Gcc-bugs
Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Short example (from https://stackoverflow.com/q/67573305/2069064): #include

[Bug c++/100835] New: defaulted equality gives wrong answer, if constexpr

2021-05-30 Thread barry.revzin at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Short example: struct B { int i; CONSTEXPR bool operator==(B const&) const = default; }; struct D : B { CONSTEXPR bool operator==(D const&

[Bug c++/101006] New: Request diagnostic for likely concept syntax errors

2021-06-09 Thread barry.revzin at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider the following: template concept Thing = true; template concept MemberThing = requires (T t) { t.member() -> Thing;// #1 !requi

[Bug c++/108744] New: error message when trying to use structured bindings in static member declaration could be cleaner

2023-02-09 Thread barry.revzin at gmail dot com via Gcc-bugs
: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider: struct X { int i, j; }; struct C { static auto [a, b] = X{1, 2}; }; This is

[Bug c++/108744] error message when trying to use structured bindings in static member declaration could be cleaner

2023-02-09 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108744 --- Comment #3 from Barry Revzin --- Yeah, they're banned in non-static data members also. But there, we just can't have any "auto" non-static data members, whereas you can have "auto" static data members (just not structured bindings).

[Bug libstdc++/108823] New: ranges::transform could be smarter with two sized ranges

2023-02-16 Thread barry.revzin at gmail dot com via Gcc-bugs
Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- >From StackOverflow (https://stackoverflow.com/q/75464599/2069064): #include #include #include #include #include #include

[Bug c++/108953] New: inefficient codegen for trivial equality

2023-02-27 Thread barry.revzin at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider this example: #include #include #include struct C { uint8_t a; uint8_t b; uint8_t c; uint8_t d; uint16_t e; uint16_t f; int32_t g; bool

[Bug libstdc++/68350] std::uninitialized_copy overly restrictive for trivially_copyable types

2022-02-23 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68350 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug c++/71283] Inconsistent location for C++ warning options in the manual

2022-03-04 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71283 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug c++/104803] New: if consteval error from branch that isn't evaluated anyway

2022-03-05 Thread barry.revzin at gmail dot com via Gcc-bugs
ormal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider this example. Yes, the body of none_of here looks... extremely bizarre. Just bear with me. template constexpr auto none_of(

[Bug c++/104803] if consteval error from branch that isn't evaluated anyway

2022-03-05 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803 --- Comment #3 from Barry Revzin --- clang is also wrong. p(i) doesn't have to be a constant expression there. The rule (http://eel.is/c++draft/expr.const#13) is "An immediate invocation shall be a constant expression." but an expression is only

[Bug c++/104803] if consteval error from branch that isn't evaluated anyway

2022-03-05 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803 --- Comment #4 from Barry Revzin --- For instance, clang accepts this version: consteval int p(int i) { return i > 2; } constexpr auto none_of(int const* f, int const* l) -> bool { for (; f != l; ++f) { int i = *f; if c

[Bug c++/104803] if consteval error from branch that isn't evaluated anyway

2022-03-07 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803 --- Comment #6 from Barry Revzin --- Ugh, sorry. You guys are right. gcc is correct to reject the example. Bad bug report.

[Bug c++/88061] section attributes of variable templates are ignored

2022-03-08 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88061 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug libstdc++/104858] New: ranges::minmax double dereferences first

2022-03-09 Thread barry.revzin at gmail dot com via Gcc-bugs
: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- In https://github.com/gcc-mirror/gcc/blob/bded0d549fdfdc1328b2c0189dc5f8593b4cbe42/libstdc%2B%2B-v3/include/bits/ranges_algo.h#L3087: the initial result is constructed as

[Bug c++/95153] Arrays of 'const void *' should not be copyable in C++20

2022-03-11 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95153 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug c++/105059] New: Inconsistency between paren- and brace-initialization of a union with anonymous struct

2022-03-25 Thread barry.revzin at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- union U { struct { int x; int y; }; long all; }; constexpr long parens() { U

[Bug other/92396] -ftime-trace support

2022-03-29 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92396 Barry Revzin changed: What|Removed |Added CC||barry.revzin at gmail dot com

[Bug c++/105195] New: spurious warning label defined but not used with if constexpr

2022-04-07 Thread barry.revzin at gmail dot com via Gcc-bugs
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Similar to other "if constexpr" related warnings, gcc warns on this example: void g(); void h(); template void f(

[Bug c++/105268] New: type/value mismatch when using variadic concept

2022-04-13 Thread barry.revzin at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- >From StackOverflow (https://stackoverflow.com/q/71864544/2069064): template concept C_one = true; template concept C_many = true; template struct S { }; templ

[Bug c++/106371] New: Bogus narrowing conversion reported due to bitfield

2022-07-20 Thread barry.revzin at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider: #include struct A { uint64_t x : 32; }; struct B { uint32_t x; }; void f() { auto a = A{.x = 1}; auto b = B{.x = a.x}; } gcc currently

[Bug c++/106596] New: Not a helpful diagnostic when putting things out of order in a member function

2022-08-12 Thread barry.revzin at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider this example: template concept C = true; template struct Widget { void foo() requires C noexcept

<    1   2   3   >