Questions tagged [compiler-bug]

For questions about (suspected) incorrect behavior of a compiler. Use with the appropriate language tag and, where applicable, with the tag for the compiler in question.

309 questions
3
votes
1 answer

Intel C++ compiler - const string is modifiable

I coded the following: #include #include #include using namespace std; string encode(const string& word) { boost::algorithm::to_upper(word); return word; } int main() { string word =…
mftrmbn
  • 113
  • 1
  • 5
3
votes
1 answer

STM32F4 not pushing/popping floating point registers

I have a code const float previousTemperature = getTemperature(); someNestedFunction(); someOtherActions(); setTemperature(previousTemperature); My problem is that in someNestedFunction(); previousTemperature gets modified. I have looked at the…
mactro
  • 518
  • 7
  • 13
3
votes
1 answer

Workaround for gcc bug: using chrono_literals in template breaks string_literals

In GCC 4.9.2 the following code fails to compile: #include #include using namespace std::literals::string_literals; using namespace std::literals::chrono_literals; template struct S { S() { "hello"s; …
M.M
  • 138,810
  • 21
  • 208
  • 365
3
votes
1 answer

VS 2015 internal compiler error for static constexpr const char* a[] = {"foo", "bar"}

this compiles fine: static constexpr char* a[] = {"foo", "bar"}; this has an internal error (C1001) asking me to turn optimizations off, any ideas why? https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k(C1001)&rd=true static…
noztol
  • 494
  • 6
  • 25
3
votes
0 answers

Bug in MSVC compiler? Clang and GCC don't complain. Testing for valid operator in compile time

So consider the following: Used for convenience (plus C++17 "support"): template using void_t = void; template using bool_constant = std::integral_constant; Then we have the main…
DeiDei
  • 10,205
  • 6
  • 55
  • 80
3
votes
0 answers

Strange behavior with nested types and generics

The following code does not compile using VS 2013: public class Base { } public class Derived : Base { public class Nested { public class Inside { } } } The compiler says: Circular…
Peter Perot
  • 1,003
  • 1
  • 10
  • 15
3
votes
1 answer

Is this a compiler bug? Am I doing something wrong?

I'm trying to make a simple map to look up some data, but the results are coming out very strange: #include "stdafx.h" #include "atlstr.h" #include enum InputTypes { Manual, Automatic, Assisted, Imported, Offline }; struct Params { int…
abelenky
  • 63,815
  • 23
  • 109
  • 159
3
votes
1 answer

C++ - "Most important const" doesn't work with expressions?

According to Herb Sutter's article http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/, the following code is correct: #include #include using namespace std; vector> f() { return…
mwnx
  • 97
  • 4
3
votes
0 answers

Pointer to member function template parameter in Visual Studio 2013

I have run into a corner case and looking for a work around. I am almost sure that it is a compiler bug and I couldn't come up with anything. I have a class which optionally requires a pointer to a member function. To allow it to be optional I made…
Cem Kalyoncu
  • 14,120
  • 4
  • 40
  • 62
3
votes
2 answers

std::shared_ptr in an std::initializer_list appears to be getting destroyed prematurely

Edit: This is indeed caused by a bug in Visual Studio - and it has already been fixed. The issue is not reproducible after applying Update 2 to Visual Studio (release candidate available here). I apologize; I thought I was up to date with my…
3
votes
1 answer

Workaround for GCC 4.8.1: sorry, unimplemented: mangling argument_pack_select

Consider the following code: #include template Result f(Function func, Types... values) { return std::get<0>(std::make_tuple(func(values)...)); } template int g(const…
Vincent
  • 57,703
  • 61
  • 205
  • 388
3
votes
1 answer

compile error on variadic template function parameter

I'm trying to write some parameter wrapping helper code like below #include #include struct test{}; namespace ns { struct test{}; } template struct arg_wrapper; template<> struct arg_wrapper { …
summerlight
  • 882
  • 7
  • 16
2
votes
1 answer

Is this an F# 2.0 parser bug?

Microsoft (R) F# 2.0 Interactive build 4.0.40219.1 I'm trying to define new record type: type TestOptions = { perRunGC : bool; collectGCStat : bool; } All is fine, but let's add one more field: type TestOptions = { perRunGC : bool; …
controlflow
  • 6,667
  • 1
  • 31
  • 55
2
votes
0 answers

Shouldn't fgets(s, n, stream) return an empty string instead of NULL for all n<=1?

According to the standard (C17 draft, 7.21.7.2), fgets (¶1) char *fgets(char * restrict s, int n, FILE * restrict stream); reads from stream at most n-1 characters (until the first '\n' (which is in this case also written to the target) or EOF)…
Lover of Structure
  • 1,561
  • 3
  • 11
  • 27
2
votes
2 answers

C++ template resolution error in recent MSVC, OK with GCC, LLVM and older MSVC

Here is some C++ template function which, in the general case, calls one of its specializations. After recently upgrading Microsoft Visual Studio to 17.5.4 (MSVC 19.35.32217), compiling the source code below produces the following compilation…
Thierry Lelegard
  • 423
  • 2
  • 11