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.
Questions tagged [compiler-bug]
309 questions
2
votes
0 answers
Possible Visual Studio c++ compiler bug ? Trouble with template template non-type parameter
New question
edit
This bug seems to be the same as this one:
MSVC rejects the following code:
template class X>
struct z
{};
template
struct x
{};
z zz;
error…

ThreeStarProgrammer57
- 2,906
- 2
- 16
- 24
2
votes
2 answers
Can a constructor definition be prefixed with the "class" keyword?
Please tell me why my program gets compiled and executed when I treat the constructor as a class without private and public sections by just writing the word class before it as follows:
class sample
{
private:
int a,b;
public:
class…

Vaibhav Hiwase
- 411
- 1
- 3
- 7
2
votes
1 answer
select_on_container_copy_construction internal error in visual studio 2013
I'm getting an internal compiler error in Visual Studio 2013. The exact error is
c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0(487): fatal error C1001: An internal error has occurred in the compiler.
2> (compiler file…

technik
- 39
- 4
2
votes
0 answers
VS 2013.1 wont expand variadic template
template
struct identity
{
virtual ~identity() {}
typedef T type;
};
template
struct _function_signature : _function_signature
{};
template
struct…

Edward A
- 2,291
- 2
- 18
- 31
2
votes
1 answer
gcc 4.7 fails to use pointer template parameter sometimes
Complete (not)working example:
struct s { int i; };
template
class struct_array
{
public:
static constexpr auto arr = _arr[0]; // works
template
struct inner // line 9, without this struct, it works
{
…

Johannes
- 2,901
- 5
- 30
- 50
2
votes
1 answer
VC++ SFINAE gives error C2070: 'overloaded-function': illegal sizeof operand
The nature of error is different than the one mentioned in this thread.
I am trying to implement an SFINAE way in VC++ environment which finds if a class contains a member (method) or not.
Below is a simplified code for that:
template

iammilind
- 68,093
- 33
- 169
- 336
2
votes
1 answer
can't pass function pointer to method in parent class through a variadic function--compiler bug?
Say you have two structures, Generic_A and Generic_B. Generic_B is derived from Generic_A. Why is it that when Generic_B tries to access a method in its parent, Generic_A, it generates the following error:
test2.cpp: In function 'int…

Sammy Rom
- 23
- 4
2
votes
1 answer
Should exporting a class make a difference?
class __declspec(dllexport) DI_1
{
DI_1& operator = (DI_1 &){};
};
class DI_2
{
DI_2& operator = (DI_2 &){};
};
int main()
{
DI_1 a;
DI_2 b;
return 0;
}
The following code when compiled with VS 2010/2012 gives the following…

AceAmit
- 23
- 4
2
votes
1 answer
gcc inline asm statement gets optimized away - wrong constraints?
I'm having trouble with a gcc inline asm statement; gcc seems to think the result is a constant (which it isn't) and optimizes the statement away. I think I am using the operand constraints correctly, but would like a second opinion on the matter.…

akruppa
- 41
- 4
1
vote
2 answers
Is this a compiler error in Visual Studio 2010?
I have a bug in this conditional:
while(CurrentObserverPathPointDisplacement > lengthToNextPoint && CurrentObserverPathPointIndex < (PathSize - 1) )
{
CurrentObserverPathPointIndex = CurrentObserverPathPointIndex + 1;
…

Arelius
- 1,216
- 8
- 15
1
vote
1 answer
Class isn't trivially_copyable if a constraint on its assignment operator is not satisfied with clang 16
Example code as below or on godbolt. clang 16/trunk believes S is not a trivially_copyable class. clang 15, gcc trunk and MSVC believe otherwise.
#include
template
struct S {
T m_t;
S(S const&) = default;
…

wanghan02
- 1,227
- 7
- 14
1
vote
0 answers
inference variable R has incompatible bounds
Today i experienced a strange error. The Strange was if i add the below code block in eclipse IDE it shows no error , but the same piece of code i compile it from cmd its showing error as
inference variable R has incompatible bounds
The Code Piece…

user3309305
- 181
- 1
- 7
1
vote
0 answers
Narrowing conversion from 'const char*' to 'bool' only in gcc
The following code compiles fine with msvc and clang but issues a narrowing warning for gcc 12.1. I think gcc is trying to do the wrong thing: It tries to convert const char* to bool even though there exists a std::string constructor in the ref…

glades
- 3,778
- 1
- 12
- 34
1
vote
1 answer
Parameter pack referenced but not expanded in a using declaration: compiler bugs or not?
Consider the following code (also available here on compiler explorer)
#include
#include
template >
struct type;
template
struct type

Vincent
- 57,703
- 61
- 205
- 388
1
vote
0 answers
Is this a bug of clang 13 on [[likely]] attribute?
The following code is accepted by gcc 11.2, but rejected by clang 13:
struct A
{
int n = 0;
constexpr operator int() const noexcept
{
if (n >= 2) [[unlikely]]
{
return 2;
}
else if (n >= 1)…

xmllmx
- 39,765
- 26
- 162
- 323